orale 查询每年、每月、每日统计量的sql语句
2024-10-13 05:34:24
每年
select to_char(createtime, 'YYYY') 年, count(*) from table group by to_char(createtime, 'YYYY');
每季度
select to_char(createtime, 'q') 年, count(*) from table group by to_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类型
最新文章
- 諾基亞定制的Android系統名為 Z Launcher
- Linux下设置网卡随系统启动
- 【codevs1044】导弹拦截问题与Dilworth定理
- 【项目管理和构建】十分钟教程,eclipse配置maven + 创建maven项目(三)
- [C#] Extension Method 扩展方法
- 长轮询和Comet
- 个人学习笔记--MyBatis-的搭建及第一个程序
- Udacity(优达学城)300块红包优惠券
- 面向新手的Webserver搭建(一)——IIS的搭建
- firefox os 2.1版本号UI接口方面有了质的飞跃
- pyspider
- jquery的$(selector).each(function(index,element))和$.each(dataresource,function(index,element))的区别
- 利用Vmware 创建Linux虚拟机的方法
- IE6条件下的bug与常见的bug及其解决方法
- 20165215 2017-2018-2 《Java程序设计》第4周学习总结
- java字符串根据空格截取并存进list,并在每个元素前后加上/
- DML DDL
- [命令]在uboot下查看文件系统的目录结构
- C++ compile Microsoft Visual C++ Static and Dynamic Libraries
- Python3基础 yield 在函数中的用法示例
热门文章
- PyCharm汉化、破解教程
- details和summary可以对内容进行折叠
- app.config 配置多项 配置集合 自定义配置(4) 自动增加配置项到配置文件的两种方法
- 二:熟悉 TCP/IP 协议
- [转载] redis 的两种持久化方式及原理
- Python进阶---面向对象第二弹
- Python之Django环境搭建(MAC+pycharm+Django++postgreSQL)
- 运行第一个 Service - 每天5分钟玩转 Docker 容器技术(96)
- [验证码识别技术]字符验证码杀手--CNN
- python 按每行读取文件怎么去掉换行符