mysql 查询每天的发帖量

WBOY
Release: 2016-06-06 20:41:00
Original
1095 people have browsed it

现在表有一个帖子表 有create_date int(11)类型的字段,存入的是发贴时间戳,我需要一个SQL查询每天的发帖数量,有什么好的SQL查询可以推荐呢?

回复内容:

现在表有一个帖子表 有create_date int(11)类型的字段,存入的是发贴时间戳,我需要一个SQL查询每天的发帖数量,有什么好的SQL查询可以推荐呢?

select DATE_FORMAT(FROM_UNIXTIME(create_date) as r_date,count(*) from table_name where DATE_FORMAT(FROM_UNIXTIME(create_date),"%Y-%m-%d %H:%i:%s") between "2014-11-21" and "2014-11-22" group by r_date;

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!