I have a table that tracks events by month and year. The field names are (you guessed it) 'month' and 'year'. I need to do queries over some date range from variables <beg_month>, <beg_year> to <end_month>, <end_year>. How can I do this?

SELECT state,
      SUM(borks) AS borkcount
FROM borkstats
WHERE ????????????
GROUP BY state
ORDER BY state

In another table like this with month/year fields I once created a dummy date field that I populated with the date of the first of the month (1/<month>/<year>), just to facilitate queries like this. Is there another approach? Can I somehow create that dummy field on the fly within the query itself?



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to