开发者

Group by day even if data is missing

I want to group results by day: max value for each of the the last 30 days. I came up with :

select max(value), DATE(time) from table where time>DATE('now', '-30 days') group by DATE(time);

But this on开发者_如何转开发ly gives results for dates with data. I want null or 0 for the dates without data. Is that possible?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜