rockysz 发表于 2010-8-31 18:49:40

请教:如何按时间段查询数据?

请教高手:
    有张表结构为id int(4), msg varchar(100), create_time datetime

    怎样查询,能查询每30分钟msg条数呢?

kider 发表于 2010-9-2 18:18:06

先给个按每一小时统计的吧:
selectleft(create_time+0,10),count(msg) from tb group by left(create_time+0,10);

页: [1]
查看完整版本: 请教:如何按时间段查询数据?