每周:

select count(*) as cnt,week(editdate) as weekflg from projects where year(editdate)=2007 group by weekflg

每月:

select count(*) as cnt,month(editdate) as monthflg from projects where year(editdate)=2007 group by monthflg

每天:

select count(*) as cnt from projects group by date(editdate)

Demo:

(thinkphp框架)

M('UserCourseSection')
->field('count(*) as nums,left(last_time, 10) as time')
->group('date(last_time)')
->order('last_time desc')
->select();
last_time 为数据库日期字段

最新文章

  1. Ubuntu Server 配置网络
  2. AngularJS拦截器
  3. android 4.4.2 开发环境
  4. C#性能优化:延迟初始化Lazy<T>
  5. ubuntu 挂起唤醒和声音偏小的问题
  6. Spring.NET学习笔记
  7. BZOJ1599: [Usaco2008 Oct]笨重的石子
  8. Java 程序员必须掌握的 Linux 命令
  9. js 创建对象
  10. php array 排序 感悟
  11. 呵呵!手把手带你在 IIS 上执行 Python
  12. BIOS和CMOS的联系与区别
  13. MySQL5.7 安装过程中出现 attempting to start service 过不去
  14. xhost和DISPLAY
  15. opencv之从视频帧中截取图片
  16. 用户端访问centos7上面的tomcat,访问页面出现的非常的慢?
  17. java批量生成用例脚本-保留字关键词的用例脚本生成
  18. SQL常见问题积累
  19. SIFT+BOW 实现图像检索
  20. js获取单选框的值

热门文章

  1. 在VBA中调用winsock控件
  2. iis 应用程序池看不到 .net framework 4.0
  3. 在Linux中永久设置Anaconda环境变量的方法
  4. 树莓派 自身摄像头的opencv调用
  5. Java多线程-线程的同步与锁
  6. SQL语句 DML,DDL,DCL
  7. ModelAttribute注解
  8. Android新浪微博获取评论信息、发表评论、转发微博等
  9. MySQL备份学习
  10. 基于WDF的PCI/PCIe接口卡Windows驱动程序(3)- 驱动程序代码(头文件)