按照年月日周季对数据进行分组
年:yyyy
月:yyyy-mm
日:yyyy-mm-dd
周:iw
季度:q
年度
select to_char(s_date,'yyyy'),count(s_user) from order group by to_char(s_date,'yyyy') order by to_char(s_date,'yyyy');
月度
select to_char(s_date,'yyyy-mm'),count(s_user) from order group by to_char(s_date,'yyyy-mm') order by to_char(s_date,'yyyy-mm');
日
select to_char(s_date,'yyyy-mm-dd'),count(s_user) from order group by to_char(s_date,'yyyy-mm-dd') order by to_char(s_date,'yyyy-mm-dd');
周
select to_char(s_date,'iw'),count(s_user),min(s_date) from order group by to_char(s_date,'iw') order by to_char(s_date,'iw');
季度
select to_char(s_date,'q'),count(s_user),min(s_date) from order group by to_char(s_date,'q') order by to_char(s_date,'q');