Hi,
This is something I need to do with one select. Here is my select:
SELECT SUM(value1) FROM mytable WHERE rec_time BETWEEN '00:00:00' AND
'00:30:00' AND YEAR(rec_date) = YEAR(NOW()) GROUP BY MONTH(rec_date)
or
SELECT SUM(value1) FROM mytable WHERE rec_time BETWEEN '00:00:00' AND
'00:30:00' AND YEAR(rec_date) = YEAR(NOW()) GROUP BY LEFT(rec_date,7 )
rec_time = time
rec_date = date
as you can see, I'm collecting summary of daily record around midnight and
building an monthly array like: 0,0,0,6.5,0,23. 7,2,0,0,5.5,0,0
BUT! my function call requires a constant-length list. So if any months in
my selection range have no data, I need to fill the space with an empy
value. How can I do this? Perhaps with an helper table, but how?
Thank in advance!
Best regards,
-Ville Vahtera, Finland
This is something I need to do with one select. Here is my select:
SELECT SUM(value1) FROM mytable WHERE rec_time BETWEEN '00:00:00' AND
'00:30:00' AND YEAR(rec_date) = YEAR(NOW()) GROUP BY MONTH(rec_date)
or
SELECT SUM(value1) FROM mytable WHERE rec_time BETWEEN '00:00:00' AND
'00:30:00' AND YEAR(rec_date) = YEAR(NOW()) GROUP BY LEFT(rec_date,7 )
rec_time = time
rec_date = date
as you can see, I'm collecting summary of daily record around midnight and
building an monthly array like: 0,0,0,6.5,0,23. 7,2,0,0,5.5,0,0
BUT! my function call requires a constant-length list. So if any months in
my selection range have no data, I need to fill the space with an empy
value. How can I do this? Perhaps with an helper table, but how?
Thank in advance!
Best regards,
-Ville Vahtera, Finland
Comment