luvmy2kids
MIS
I have the below query:
DECLARE @StartDate datetime
SET @StartDate = '2009-7-27'
DECLARE @EndDate datetime
SET @EndDate = '2009-8-02'
select count (distinct employeeid), busunitdesc
from invinvoicedetail inv
inner join invinvoiceheader b on b.invoiceid = inv.invoiceid
inner join ssbusunit u on u.busunitid = inv.busunit
where b.invoicedate between @StartDate and @EndDate Group by busunitdesc
Which returns these results:
498 HR Solutions
1020 HR Solutions RTI
My ultimate goal is to get the total to add up to 1,518? If I do a distinct count without grouping, it returns 1,513 because there are 5 employees that are part of both groupings. How can I get a sum of 1,518?
Thanks a bunch
DECLARE @StartDate datetime
SET @StartDate = '2009-7-27'
DECLARE @EndDate datetime
SET @EndDate = '2009-8-02'
select count (distinct employeeid), busunitdesc
from invinvoicedetail inv
inner join invinvoiceheader b on b.invoiceid = inv.invoiceid
inner join ssbusunit u on u.busunitid = inv.busunit
where b.invoicedate between @StartDate and @EndDate Group by busunitdesc
Which returns these results:
498 HR Solutions
1020 HR Solutions RTI
My ultimate goal is to get the total to add up to 1,518? If I do a distinct count without grouping, it returns 1,513 because there are 5 employees that are part of both groupings. How can I get a sum of 1,518?
Thanks a bunch