sql server - SQL Overlapping Date Range -
i have table 3 fields "start date" , "end date" , "allocation %". need find out records in table falls within 3 months current date,
and (this 1 tricky) records overlapped date ranges sum(allocation %) > 100.
please me come query.
this table schema.
table (resourceassignment) - resourceassignmentid (pk) - resourceid (fk) - assigned (fk) - start date - end date - allocation %
i need find on allocated resources within period (from current day 3 months).
thanks in advance!
not sure if you're after, show resourceid allocation above 100% begin or end date within last 3 months:
select resourceid resourceassignment startdate between dateadd(month,-3,getdate()) , getdate() or enddate between dateadd(month,-3,getdate()) , getdate() group resourceid having sum([allocation %]) > 100
Comments
Post a Comment