Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. select
  2. datepart(wk,Subscription_Date) as WeekNo,
  3. sum(case when Subscription_Type = 1 then 1 else 0 end) as TotalSubcriptions
  4. from tbSubscriptions
  5. group by datepart(wk,Subscription_Date)
  6. order by 1
  7.  
  8. WeekNo |Total Subscriptions
  9. 21 |12
  10. 22 |13
  11. 23 |8
  12. 24 |18
  13.  
  14. WeekNo |CumulativeSubscriptions
  15. 21 |12
  16. 22 |25 (=12+13)
  17. 23 |33 (=25+8)
  18. 24 |51 (=33+18)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement