标题: 【求助】sybase中,按照整数字段分组 [打印本页] 作者: uman 时间: 2011-08-11 10:02 标题: 【求助】sybase中,按照整数字段分组 是这样的,有个字段是整型,就是unixtime了
我想按这个字段分组统计每天的情况,
例如
select count(1) from table where unix_time between 1312732800 and 1312819200
..........
这是某一天
基本是每天都有
那么如何实现按unix time字段分组,每天增加86400秒。作者: uman 时间: 2011-08-11 16:26
就是类似excel的数据透视表的时候的分组功能作者: chenfeng825 时间: 2011-08-11 16:43
用join一个连续序列吧
select count(1), o.id from table join sysobjects on unix_time between 1312732800 +(id-1)*86400 and 1312732800+o.id*86400
where id <=10 group by o.id