Guest User

Untitled

a guest
Apr 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Student ApplicationDate
  2. ------- ---------------
  3. Barry 2009-01-01
  4. Barry 2009-01-20
  5. Barry 2009-01-23
  6. Barry 2009-02-01
  7. Barry 2009-02-15
  8. Barry 2009-03-01
  9.  
  10. Student Month Applications
  11. ------- ----- ------------
  12. Barry 1/2009 3
  13. Barry 2/2009 2
  14. Barry 3/2009 1
  15.  
  16. SELECT
  17. student,
  18. DATE_FORMAT(ApplicationDate,'%m/%Y') as Month
  19. count(id) as Applications
  20. from YourTable
  21. group by ApplicationDate
  22.  
  23. select
  24. student,
  25. year(ApplicationDate),
  26. month(ApplicationDate),
  27. count(*) as Applications
  28. from YourTable
  29. group by student, year(ApplicationDate), month(ApplicationDate)
  30.  
  31. select Student,
  32. DATE_FORMAT(ApplicationDate,'%m/%Y') as 'Month',
  33. count(*) as 'Applications'
  34. from tableName
  35. group by Student, month(ApplicationDate), year(AppilcationDate)
  36. order by year(ApplicationDate), month(ApplicationDate), Student
  37.  
  38. select Student, month(ApplicationDate) ApplicationMonth, count(*)
  39. from table_name
  40. group by Student, ApplicationMonth
Add Comment
Please, Sign In to add comment