Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. year month subchannel count(*)
  2. 2013 10 creativemornings 1
  3. 2014 3 creativemornings 2
  4. 2013 11 founderinstitute 1
  5.  
  6. year month subchannel count(*)
  7. 2013 10 creativemornings 1
  8. 2013 11 creativemornings 0
  9. 2013 12 creativemornings 0
  10. 2014 1 creativemornings 0
  11. 2014 2 creativemornings 0
  12. 2014 3 creativemornings 2
  13. 2013 10 founderinstitute 0
  14. 2013 11 founderinstitute 1
  15. 2013 12 founderinstitute 0
  16. 2014 1 founderinstitute 0
  17. 2014 2 founderinstitute 0
  18. 2014 3 founderinstitute 0
  19.  
  20. SELECT
  21. year(l.created) as year,
  22. month(l.created) as month,
  23. l.subchannel,
  24. count(*)
  25.  
  26. FROM db.l_events l
  27.  
  28. right JOIN db.calendar c
  29. ON (date(l.created) = c.datefield)
  30.  
  31. WHERE
  32. l.created between '2013-10-01' and '2014-03-31'
  33.  
  34. group by
  35. l.subchannel,
  36. year(l.created),
  37. month(l.created)
  38. ;
  39.  
  40. SELECT
  41. year(c.datefield) as year,
  42. month(c.datefield) as month,
  43. s.subchannel,
  44. count(l.created)
  45. FROM db.calendar c
  46. CROSS JOIN (select distinct subchannel from l_events) s
  47. LEFT JOIN db.l_events l
  48. ON (date(l.created) = c.datefield)
  49. AND l.subchannel = s.subchannel
  50. Where c.datefield between '2013-10-01' and '2014-03-31'
  51. group by
  52. s.subchannel,
  53. year(c.created),
  54. month(.created)
  55. order by
  56. s.subchannel,
  57. year(c.created),
  58. month(.created)
  59. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement