Home  >  Article  >  Backend Development  >  mysql 查询每天的发帖量

mysql 查询每天的发帖量

WBOY
WBOYOriginal
2016-06-06 20:41:001133browse

现在表有一个帖子表 有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;

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