每年select to_char(createtime, ‘YYYY’) 年, count(*) from table group by to_char(createtime, ‘YYYY’);每季度select to_char(createtime, ‘q’) 年, count(*) from table group by tooracle账号_char(createtime, ‘q’);每月select to_char(createtime, ‘YYYY’) 年, to_char(createtime, ‘mm’) 月, count(*) from table group by to_char(createtime, ‘YYYY’), to_char(createtime, ‘mm’);每日select to_char(createtime, ‘YYYY’) 年,to_char(createtime, ‘mm’) 月,to_char(createtime, ‘dd’) 日, count(*) from table group by to_char(createtime, ‘YYYY’), to_char(createtime, ‘mm’),to_char(createtime, ‘dd’);其中createtime为date类型,如果为varchar先要转换为date类型
文章归档
- 2021年11月
- 2021年10月
- 2021年9月
- 2021年8月
- 2021年7月
- 2021年6月
- 2021年5月
- 2021年4月
- 2021年3月
- 2021年2月
- 2021年1月
- 2020年12月
- 2020年11月
- 2020年10月
- 2020年9月
- 2020年8月
- 2020年7月
- 2020年6月
- 2020年5月
- 2020年4月
- 2020年3月
- 2020年2月
- 2020年1月
- 2019年12月
- 2019年11月
- 2019年10月
- 2019年9月
- 2019年8月
- 2019年7月
- 2019年6月
- 2019年5月
- 2019年4月
- 2019年3月
- 2019年2月
- 2019年1月
- 2018年12月
- 2018年11月