[BNM] MySQL date-range query
Karim Ahmed
bnm at karimahmed.com
Tue May 13 12:36:48 BST 2008
I have a MySQL problem:
I want to build a query that returns a row for each month/year in a
given date range even if there is no data for a given month/year:
e.g.
Date Range:
2008-01 to 2008-05
Actual data returned by a standard query:
Month/year value
2008-01 10.8
2008-04 23.4
2008-05 98.8
Result set I want:
Month/year value
2008-01 10.8
2008-02 0
2008-03 0
2008-04 23.4
2008-05 98.8
Any elegant suggestions thankfully received.
Karim
More information about the BNMlist
mailing list. Powered by Wessex Networks