mysql统计一年12月的数据
效果图:

select
sum(case month(createTime) when '' then 1 else 0 end) as 一月份,
sum(case month(createTime) when '' then 1 else 0 end) as 二月份,
sum(case month(createTime) when '' then 1 else 0 end) as 三月份,
sum(case month(createTime) when '' then 1 else 0 end) as 四月份,
sum(case month(createTime) when '' then 1 else 0 end) as 五月份,
sum(case month(createTime) when '' then 1 else 0 end) as 六月份,
sum(case month(createTime) when '' then 1 else 0 end) as 七月份,
sum(case month(createTime) when '' then 1 else 0 end) as 八月份,
sum(case month(createTime) when '' then 1 else 0 end) as 九月份,
sum(case month(createTime) when '' then 1 else 0 end) as 十月份,
sum(case month(createTime) when '' then 1 else 0 end) as 十一月份,
sum(case month(createTime) when '' then 1 else 0 end) as 十二月份,
year(createTime) as year
from fire_disaster
where year(createTime) in('','','','') group by year;
参考地址: https://blog.csdn.net/w3chhhhhh/article/details/54097890
mysql统计一年12月的数据的更多相关文章
- Mysql统计每年每个月的数据——详细教程
Mysql统计每年每个月的数据(前端页面统计图实现) 最终想实现的效果图,在这里就不多废话了,直接上效果图,由于测试数据有几个月是为0的,所以数据图看着会有点怪怪. 接下来是数据库的两个表,这里直接给 ...
- mysql时间统计,查询月份,周数据
在mysql数据库中,常常会遇到统计当天的内容.例如,在user表中,日期字段为:log_time 统计当天 sql语句为: select * from user where date(log_tim ...
- MySQL查询近一个月的数据
MySQL查询近一个月的数据 近一个月统计SQL select user_id, user_name, createtime from t_user where DATE_SUB(CURDATE(), ...
- mysql统计天、周、月、季度、半年、年
之前在网上搜索按时间统计,发现不是很全 ,接着别人的思路进行延伸下, mysql统计天.周.月.季度.半年.年 前期工作创建辅助表 CREATE TABLE num (i INT); ),(),(), ...
- MySQL中获取天、周、月等数据
MySQL中获取天.周.月等数据 1.今天 select * from 表名 where to_days(时间字段名) = to_days(now()); 2.昨天 SELECT * FROM 表名 ...
- PHP+MySQL实现对一段时间内每天数据统计优化操作实例
http://www.jb51.net/article/136685.htm 这篇文章主要介绍了PHP+MySQL实现对一段时间内每天数据统计优化操作,结合具体实例形式分析了php针对mysql查询统 ...
- MySQL 查询当天、本周,本月、上一个月的数据
mysql查询当天的所有信息: SELECT * FROM 表名 WHERE year(时间字段名)=year(now()) and month(时间字段名) = month(now()) and d ...
- 12月22日《奥威Power-BI财务报表数据填报》腾讯课堂开课啦
一扇可以通向任何地方的“任意门”,是我们多少人幼时最梦寐以求的道具之一.即使到了现在,工作中的我们还会时不时有“世界那么大,我想去看看”的念头,或者在突然不想工作的时刻,幻想着自己的家门变成了“任意门 ...
- 大数据技术人年度盛事! BDTC 2016将于12月8-10日在京举行
2016年12月8日-10日,由中国计算机学会(CCF)主办,CCF大数据专家委员会承办,中国科学院计算技术研究所和CSDN共同协办的2016中国大数据技术大会(Big Data Technology ...
随机推荐
- spark之java程序开发
spark之java程序开发 1.Spark中的Java开发的缘由: Spark自身是使用Scala程序开发的,Scala语言是同时具备函数式编程和指令式编程的一种混血语言,而Spark源码是基于Sc ...
- 18.Class 的基本语法
Class 的基本语法 Class 的基本语法 简介 JavaScript 语言中,生成实例对象的传统方法是通过构造函数.下面是一个例子. function Point(x, y) { this.x ...
- 使用.Net Core 2.1开发Captcha图片验证码服务
更新后续篇:Captcha服务(后续1) 使用.Net Core 2.1开发Captcha验证码服务 开发工具:Visual Studio 2017 15.7.3 开发平台:64位 Windows 1 ...
- C# 使用 PerformanceCounter 获取 CPU 和 硬盘的使用率
C# 使用 PerformanceCounter 获取 CPU 和 硬盘的使用率: 先看界面: 建一个 Windows Form 桌面程序,代码如下: using System; using Sys ...
- VB.NET 使用ADODB連接資料庫滙出到EXCEL
'導入命名空間 Imports ADODB Imports Microsoft.Office.Interop Private Sub A1() Dim Sql As StringDim Cnn As ...
- 29.QT-自定义窗口拖动、自定义QToolButton/QPushButton开关按钮、界面阴影,声音等总结
自定义窗口及拖动 1.自定义无边框窗口时,需要将窗口标志设为: Qt::FramelessWindowHint |Qt::WindowSystemMenuHint | Qt::WindowMinMax ...
- Java_Queue接口
Queue接口 1.英文 a) Queue 队列 b) Deque ,Double ender queue缩写,双向队列 2.Queue接口 除了基本的 Collect ...
- 怎么打开在.bashrc文件以及设置颜色
打开/etc/bashrc,加入如下一行: alias ls="ls --color" 下次启动bash时就可以像在Slackware里那样显示彩色的目录列表了,其中不同颜 ...
- angular select2 ng-model 取值 ng-change调用方法
页面: 引入文件 '/select2.css', '/select2-bootstrap.css', '/select2.min.js', '/ui-select2.js' html: <div ...
- canvas-a12ellipse.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...