Oracle按天、月份、年份查询

2018-07-23  本文已影响0人  xhlc02

//按天统计

select count(*)

from user

group by trunc(你要按天查询的时间, 'DD'))

//按自然周统计

select to_char(date,'iw')

from  user

group by to_char(date,'iw')

//按自然月统计

select to_char(date,'mm')

from   user

group by to_char(date,'mm')

//按季统计

select to_char(date,'q')

from  user

group by to_char(date,'q')

//按年统计

select to_char(date,'yyyy')

from  user

group by to_char(date,'yyyy')

友情链接:https://shop117143218.taobao.com/shop/view_shop.htm?spm=a313o.201708ban.category.d53.64f0197aXY7Er3&mytmenu=mdianpu&user_number_id=1070606134

转载自:http://blog.csdn.net/u011659172/article/details/40186009

上一篇 下一篇

猜你喜欢

热点阅读