mysql 统计
2024-08-26 06:50:46
每周:
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 为数据库日期字段
最新文章
- Ubuntu Server 配置网络
- AngularJS拦截器
- android 4.4.2 开发环境
- C#性能优化:延迟初始化Lazy<;T>;
- ubuntu 挂起唤醒和声音偏小的问题
- Spring.NET学习笔记
- BZOJ1599: [Usaco2008 Oct]笨重的石子
- Java 程序员必须掌握的 Linux 命令
- js 创建对象
- php array 排序 感悟
- 呵呵!手把手带你在 IIS 上执行 Python
- BIOS和CMOS的联系与区别
- MySQL5.7 安装过程中出现 attempting to start service 过不去
- xhost和DISPLAY
- opencv之从视频帧中截取图片
- 用户端访问centos7上面的tomcat,访问页面出现的非常的慢?
- java批量生成用例脚本-保留字关键词的用例脚本生成
- SQL常见问题积累
- SIFT+BOW 实现图像检索
- js获取单选框的值