在oracle中怎么通过月份查询数据? ---例如交易数据这种,需要统计每个月的数据
1 拿到日期中的月份
to_char([该日期字段],'mm')
2 将月份转为number型
to_number(to_char([该日期字段],'mm'))
eg:例子:
查询4月的数据
select * from 表名where to_number(to_char([该日期字段],'mm'))
其实超简单的 对吧!
1 拿到日期中的月份
to_char([该日期字段],'mm')
2 将月份转为number型
to_number(to_char([该日期字段],'mm'))
eg:例子:
查询4月的数据
select * from 表名where to_number(to_char([该日期字段],'mm'))
其实超简单的 对吧!