每年
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类型

最新文章

  1. 諾基亞定制的Android系統名為 Z Launcher
  2. Linux下设置网卡随系统启动
  3. 【codevs1044】导弹拦截问题与Dilworth定理
  4. 【项目管理和构建】十分钟教程,eclipse配置maven + 创建maven项目(三)
  5. [C#] Extension Method 扩展方法
  6. 长轮询和Comet
  7. 个人学习笔记--MyBatis-的搭建及第一个程序
  8. Udacity(优达学城)300块红包优惠券
  9. 面向新手的Webserver搭建(一)——IIS的搭建
  10. firefox os 2.1版本号UI接口方面有了质的飞跃
  11. pyspider
  12. jquery的$(selector).each(function(index,element))和$.each(dataresource,function(index,element))的区别
  13. 利用Vmware 创建Linux虚拟机的方法
  14. IE6条件下的bug与常见的bug及其解决方法
  15. 20165215 2017-2018-2 《Java程序设计》第4周学习总结
  16. java字符串根据空格截取并存进list,并在每个元素前后加上/
  17. DML DDL
  18. [命令]在uboot下查看文件系统的目录结构
  19. C++ compile Microsoft Visual C++ Static and Dynamic Libraries
  20. Python3基础 yield 在函数中的用法示例

热门文章

  1. PyCharm汉化、破解教程
  2. details和summary可以对内容进行折叠
  3. app.config 配置多项 配置集合 自定义配置(4) 自动增加配置项到配置文件的两种方法
  4. 二:熟悉 TCP/IP 协议
  5. [转载] redis 的两种持久化方式及原理
  6. Python进阶---面向对象第二弹
  7. Python之Django环境搭建(MAC+pycharm+Django++postgreSQL)
  8. 运行第一个 Service - 每天5分钟玩转 Docker 容器技术(96)
  9. [验证码识别技术]字符验证码杀手--CNN
  10. python 按每行读取文件怎么去掉换行符