看半天才明白你想要啥结果,看看是这个结果不?
SELECT  to_char(creattime, 'yyyy-mm-dd')creattime,count(distinct id),count(1)
from network_checkin
group by to_char(creattime, 'yyyy-mm-dd')

解决方案 »

  1.   

    对的,达到了要的效果,谢谢,我上面的是统计每一天不同时段的单数,还有个就是单据状态(正常,延迟,提前),现在每天的单数是统计出来了,但还要统计出每天正常多少单,延迟多少单,提前多少单,是单据状态,要是单个状态的统计单量,可以这样的统计select count(*)n,to_char(creattime, 'yyyy-mm-dd') from network_checkin where to_char(creattime, 'yyyy-mm-dd') > '2014-11-25 15:53:11'  and =0
    group by to_char(creattime, 'yyyy-mm-dd')
    order by to_char(creattime, 'yyyy-mm-dd'),但是我还想统计这一天延迟单量啊,提前单量,该怎么写呢,求大神赐教