MySQL Stats summary-last 30 days, yesterday's stats

Source: Internet
Author: User

--Number of medical releases released in the last 30 days
SELECT substr (a.feed_publish_time,6, 5) as ' Date ', COUNT (*) as ' medical say number ' from Xm_feed a WHERE
Date_sub (Curdate (), INTERVAL) <= a.feed_publish_time GROUP by substr (a.feed_publish_time,1, 10);

--the number of medical comments released in the last 30 days
SELECT substr (a.comm_create_time,6, 5) as ' Date ', COUNT (*) as ' medical commented number ' from Xm_feed_comment a WHERE date_sub (Curdate (), Interv AL <= a.comm_create_time GROUP by substr (a.comm_create_time,1, 10);

--The number of medical diffusion releases in the last 30 days
SELECT substr (a.repost_create_time,6, 5) as ' Date ', COUNT (*) as ' medical commented number ' from Xm_feed_repost a WHERE date_sub (Curdate (), INTER VAL <= a.repost_create_time GROUP by substr (a.repost_create_time,1, 10);

--The last 30 days of medical talk about the number of likes released
SELECT substr (a.digg_create_time,6, 5) as ' Date ', COUNT (*) as ' medical commented number ' from Xm_feed_digg a WHERE date_sub (Curdate (), INTERVAL <= a.digg_create_time GROUP by substr (a.digg_create_time,1, 10);

--Yesterday's data
SELECT Count (*) as Num from Xm_user a WHERE a.user_audit_status = ' audited ' and Date_sub (Current_date (), Interval 1 day) = SUBSTR (a.user_create_time,1, 10);
SELECT Count (*) as Num from Xm_user a WHERE date_sub (current_date (), Interval 1 day) = substr (a.user_create_time,1, 10);
SELECT Count (*) as Num from Xm_feed a WHERE date_sub (current_date (), Interval 1 day) = substr (a.feed_publish_time,1, 10);
SELECT Count (*) as Num from Xm_feed_comment a WHERE date_sub (current_date (), Interval 1 day) = substr (a.comm_create_time,1, 10);
SELECT Count (*) as Num from Xm_feed_repost a WHERE date_sub (current_date (), Interval 1 day) = substr (a.repost_create_time,1 , 10);
SELECT Count (*) as Num from Xm_feed_digg a WHERE date_sub (current_date (), Interval 1 day) = substr (a.digg_create_time,1, 10 );

MySQL Stats summary-last 30 days, yesterday's stats

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.