Sign up to create your own snipts, or login.

Public snipts » robertbanh's snipts » Count Monthly/Yearly Totals in MySQL

posted on Jan 21, 2010 at 5:01 p.m. EST in 
  • SELECT 
          MONTHNAME(createDt) AS month,
          YEAR(createDt) AS year,
          COUNT(*) AS total
    FROM tracking
    GROUP BY MONTH(createDt), YEAR(createDt)
    ORDER BY id
    

    copy | embed

0 Comments

Sign up, or login to leave a comment.