Advertisement
Advertisement
| 07.01.2008 at 06:47AM PDT, ID: 23530092 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: |
1st Select: select distinct userid from dbo.ActivityTrx where activitydate > '1/1/2007' 2nd Select Select userid , count(activityiD) as 'Total Activities' ,MONTH, year from ( select activityID, userid, CASE MONTH(activitydate) WHEN 1 THEN 'JANUARY' WHEN 2 THEN 'FEBRUARY' WHEN 3 THEN 'MARCH' WHEN 4 THEN 'APRIL' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUNE' WHEN 7 THEN 'JULY' WHEN 8 THEN 'AUGUST' WHEN 9 THEN 'SEPTEMBER' WHEN 10 THEN 'OCTOBER' WHEN 11 THEN 'NOVEMBER' WHEN 12 THEN 'DECEMBER' END AS [MONTH], year(activitydate) as year from dbo.ActivityTrx) as ttt where ttt.Month=@varmonth and ttt.Year=@varyear group by userid, Month, year order by userid, year, month |