Code:
select EndVal as Status , DATEADD(DAY , 7-DATEPART(WEEKDAY,convert(datetime,convert(char(10),Created,101))),convert(datetime,convert(char(10),Created,101))) AS 'Last Day Of Week' from tblFieldAudit Where EndVal IN (select distinct Status from tblStatus) order by 'Last Day Of Week' desc, Created desc
Submitted 2010-11-27 00:00:00.000
Special 2010-11-27 00:00:00.000
Submitted 2010-11-27 00:00:00.000
Special 2010-11-27 00:00:00.000
Submitted 2010-11-27 00:00:00.000
Under Review 2010-11-20 00:00:00.000
Further Review Required 2010-11-20 00:00:00.000
Application Received 2010-11-20 00:00:00.000
...
I need it to count the group by date and status. So all of the records which are in a status and have the same date will be counted:
Status / count / date
Submitted / 5 / 010-11-27 00:00:00.000
any words of wisdom, dear internet?
Comment