sql 按天然周,月,季度,年統計

//按天然周統計 
select to_char(date,'iw'),sum() 
from 
where 
group by to_char(date,'iw') 

//按天然月統計 
select to_char(date,'mm'),sum() 
from 
where 
group by to_char(date,'mm') 

//按季統計 
select to_char(date,'q'),sum() 
from 
where 
group by to_char(date,'q') 

//按年統計 
select to_char(date,'yyyy'),sum() 
from 
where 
group by to_char(date,'yyyy') 
相關文章
相關標籤/搜索