select t.staffid, count(*), to_char(t.opertime, 'yyyy-mm') aaa
from t_bsf_operatelog t
where t.staffid = '101'
group by to_char(t.opertime, 'yyyy-mm'), t.staffid;
select t.staffid, count(*), to_char(t.opertime, 'yyyy-mm dd') aaa
from t_bsf_operatelog t
where t.staffid = '101'
group by to_char(t.opertime, 'yyyy-mm dd'), t.staffid
select t.staffid, count(*), to_char(t.opertime, 'iw') aaa
from t_bsf_operatelog t
where t.staffid = '101'
group by to_char(t.opertime, 'iw'), t.staffid
from t_bsf_operatelog t
where t.staffid = '101'
group by to_char(t.opertime, 'yyyy-mm'), t.staffid;
select t.staffid, count(*), to_char(t.opertime, 'yyyy-mm dd') aaa
from t_bsf_operatelog t
where t.staffid = '101'
group by to_char(t.opertime, 'yyyy-mm dd'), t.staffid
select t.staffid, count(*), to_char(t.opertime, 'iw') aaa
from t_bsf_operatelog t
where t.staffid = '101'
group by to_char(t.opertime, 'iw'), t.staffid
本文提供了使用SQL进行分组查询的三个实例,包括按月份、日期和周进行的统计数据查询。

被折叠的 条评论
为什么被折叠?



