Guest User

Untitled

a guest
Jun 25th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. month
  2. ------------
  3. month_id -- 1-12
  4. month_name -- Jan - Dec
  5.  
  6. Sales
  7. ------------
  8. month_id --not every month has sale
  9. product
  10. amount
  11.  
  12. select
  13. month_name
  14. ,product
  15. ,sum(isnull(amount,0))
  16. from
  17. month
  18. left outer join sales
  19. on sales.month_id = month.month_id
  20. group by
  21. month_name
  22. ,product
Add Comment
Please, Sign In to add comment