在oracle中怎么通过月份查询数据? ---例如交易数据这种,需要统计每个月的数据

1  拿到日期中的月份 

to_char([该日期字段],'mm')

2  将月份转为number型

to_number(to_char([该日期字段],'mm'))

eg:例子:

查询4月的数据

select * from 表名where to_number(to_char([该日期字段],'mm'))

其实超简单的  对吧!

posted @ 2020-07-24 16:33  dangerous_11  阅读(1049)  评论(0)    收藏  举报