Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Select Service, Sum(Qty_Sold) as Total
  2. From Services
  3. Where Service in ('1','2','3','4')
  4. Group By Service
  5.  
  6. Service Total
  7. 1 8
  8. 2 9
  9. 3 22
  10. 4 11
  11.  
  12. Service Total
  13. 1 8
  14. 2 9
  15. 3 22
  16. 4 11
  17. 7 1
  18.  
  19. Service Total
  20. 1 8
  21. 2 9
  22. 3 22
  23. 4 12
  24.  
  25. Select * from
  26. (
  27. Select Case When Service = '7' then '4' Else Service, Sum(Qty_Sold) as Total
  28. From Services
  29. Where Service in ('1','2','3','4')
  30. Group By Service)
  31. Group By Services, Total
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement