时间字段在sql语句中只能查询出有记录的数,如何让他按照顺序补全?
h0-h23这个字段库中没有,怎么拿到?或者其他的方法获得显示值是h0-h23,真实值为0-23的一个序列?
没有值的情况下怎么让它为零?
select substr(t,1,7) day,substr(t,12,2) time ,count(*) num from
(select id,fromtime t from stable where fromtime>='2018-04-09 00:00:00' and fromtime <='2018-05-14 23:59:59') group by substr(t,1,7),substr(t,12,2) order by substr(t,1,7),substr(t,12,2)
结果图2
怎么拿解决这三个问题?