
1 kerie Jun 1, 2011 我也遇到类似的问题,求会的人解答一下 |
2 napoleonu Jun 1, 2011 select c.dt,ifnull(tmp1.format_t,0) from (select date_format(t1.CreateTime, '%Y-%m-%d %H:00:00') format_t, count(*) count_c from Table1 t1 group by t1.t) tmp1 right join Calendar c on tmp1.format_t=c.dt; |
3 billychow Jun 1, 2011 难道一定要用 MySQL?就为了生成一个连续的时间还得再去造个 Calendar 表? 如果你一定要纠结于这种方式实现的话,那么子查询再联接表应该可以搞定。 PS: 好久木写过 SQL 了,连语法都忘得差不多了 |
4 napoleonu Jun 1, 2011 group by t1.format_t 不好意思。。 |
5 raptium Jun 1, 2011 这是考 outer join 对吧= = |
6 AntiGameZ OP |