首页 > 代码库 > mysql_SQL_按照日统计微博数

mysql_SQL_按照日统计微博数

 

 

主要备忘: DATE_FORMAT 函数

1:微博对比图(按日统计)

SELECT DATE_FORMAT(tw.article_publish_time, ‘%Y-%m-%d‘),count(page_id) FROM `tab_weibo` tw where tw.page_id =1002065079349665 group BY DATE_FORMAT(tw.article_publish_time, ‘%Y-%m-%d‘) ORDER BY DATE_FORMAT(tw.article_publish_time, ‘%Y-%m-%d‘) desc;

2: 微博转发数评论数(按日统计)

SELECT DATE_FORMAT(tw.article_publish_time, ‘%Y-%m-%d‘),SUM( tw.article_comment_count),SUM( tw.article_repost_count) FROM `tab_weibo` tw where tw.page_id =1002065079349665 group BY DATE_FORMAT(tw.article_publish_time, ‘%Y-%m-%d‘) ORDER BY DATE_FORMAT(tw.article_publish_time, ‘%Y-%m-%d‘) desc;

--1002061767910704 东方卫视番茄台
--1002063919397450 ****
--1002065067321419 ***
--1002065079349665 ***