I am trying to report on data in e-email messaging system and wanted to have SQL tally counts by month/year.
select year(crdate ) as y, month(crdate ) as m, count(*) as tally from message
where year(crdate ) = 2012
and subject <> 'Welcome' -- exclude default messages
group by year(crdate ), month(crdate )
This is what I have but its limiting in that I need to manually change years. Can this be upgraded to output for all dates in the table in this month/year format?
year(crdate ) = 2012condition? – ypercube Feb 1 at 15:51