Home >Database >Mysql Tutorial >按照每天、每月、每年统计数据_MySQL

按照每天、每月、每年统计数据_MySQL

WBOY
WBOYOriginal
2016-06-01 13:07:451380browse
                 在网上找了好长时间终于找到了你select DATE_FORMAT(时间字段,'%Y%u') weeks,count(你需要的字段) count from 表名字 group by weeks;select DATE_FORMAT(时间字段,'%Y%m%d') days,count(你需要的字段) count from 表名字 group by days;select DATE_FORMAT(时间字段,'%Y%m') months,count(你需要的字段) count from 表名字 group by months;说一下啊,我标注的汉子的地方时你需要更改的地方,其余的就不要再动了,你可以拿到你的mysql上去查询一下,一定会给你惊喜的,祝你成功,我用它们成功了。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn