Use the MySQL statistics page to access and rank

Source: Internet
Author: User

Count the number of access pages and rank them in resolution

SELECT CONCAT (' height ', ' * ', ' width ') as ' resolution ', COUNT (CONCAT (' height ', ' * ', ' width ')) as ' total ' from ' Wifi_statu S_page ' GROUP by CONCAT (' height ', ' * ', ' width ') ORDER by ' total ' DESC LIMIT 0, 30

Page visits in the last 7 days, daily statistics, in the order of dates

Select TD as Showdate, COALESCE (totalcount, 0) as TotalCount from (SELECT curdate () as tdunion all SELECT Date_add (CUR DATE (), INTERVAL-1 Day) union ALL Select Date_add (Curdate (), INTERVAL-2 Day) union ALL Select Date_add (Curdate ( ), INTERVAL-3 Day) union ALL Select Date_add (Curdate (), INTERVAL-4 Day) union ALL Select Date_add (Curdate (), in TERVAL-5 day) UNION all SELECT Date_add (Curdate (), INTERVAL-6 Day) ORDER by TD) Aleft JOIN (SELECT from_unixtime (ADD _time, '%y-%m-%d ') Add_data, COUNT (ID) as Totalcountfrom wifi_status_pagewhere from_unixtime (add_time, '%Y-%m-%d ') BETW EEN Date_add (Curdate (), INTERVAL-6 Day) and Curdate () GROUP by Add_data) b on a.td = B.add_data

Page visits in the last 30 days, daily statistics, in the order of dates

Select TD as Showdate, COALESCE (totalcount, 0) as TotalCount from (SELECT curdate () as tdunion all SELECT date_add (curd ATE (), INTERVAL-1 Day) union ALL Select Date_add (Curdate (), INTERVAL-2 Day) union ALL Select Date_add (Curdate (), INTERVAL  -3 Day) UNION ALL Select Date_add (Curdate (), INTERVAL-4 Day) union ALL Select Date_add (Curdate (), INTERVAL-5 Day) UNION ALL SELECT Date_add (Curdate (), INTERVAL-6 Day) union ALL Select Date_add (Curdate (), INTERVAL-7 Day) union ALL select Date_add (Curdate (), INTERVAL-8 Day) UNION ALL Select Date_add (Curdate (), INTERVAL-9 Day) union ALL Select Date_add (Curdate (), INTERVAL-10 Day) UNION ALL Selec T Date_add (Curdate (), INTERVAL-11 Day) union ALL Select Date_add (Curdate (), INTERVAL-12 Day) union ALL select Date_add (CUR DATE (), INTERVAL-13 Day) union ALL Select Date_add (Curdate (), INTERVAL-14 Day) union ALL Select Date_add (Curdate (), Interv AL-15 Day) UNION ALL Select Date_add (Curdate (), INTERVAL-16 Day) union ALL Select Date_add (Curdate (), INTERVAL-17 Day) UNION ALL Select Date_add (Curdate (), INTERVAL-18 Day) union ALL Select Date_add (Curdate (), INTERVAL-19 Day) UNION ALL SEL ECT Date_add (Curdate (), INTERVAL-20 Day) union ALL Select Date_add (Curdate (), INTERVAL-21 Day) union ALL select Date_add (C Urdate (), INTERVAL-22 Day) union ALL Select Date_add (Curdate (), INTERVAL-23 Day) union ALL Select Date_add (Curdate (), INTE RVAL-24 Day) UNION ALL Select Date_add (Curdate (), INTERVAL-25 Day) union ALL Select Date_add (Curdate (), INTERVAL-26 Day) U Nion All Select Date_add (Curdate (), INTERVAL-27 Day) union ALL Select Date_add (Curdate (), INTERVAL-28 Day) UNION ALL Selec  T Date_add (Curdate (), INTERVAL-29 Day) ORDER by TD) Aleft JOIN (SELECT from_unixtime (add_time, '%y-%m-%d ') Add_data, COUNT ( ID) as Totalcountfrom wifi_status_pagewhere from_unixtime (add_time, '%y-%m-%d ') between Date_add (CURDATE (), INTERVAL-2 9 day) and Curdate () GROUP by Add_data) b on a.td = B.add_data

Yesterday 24 hours of ticks

Select TD as Showhourfrom (select Date_add (Curdate (), INTERVAL-1 HOUR) as tdunion all SELECT Date_add (Curdate (), INTERVAL  -2 HOUR) UNION ALL Select Date_add (Curdate (), INTERVAL-3 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-4 HOUR) union All Select Date_add (Curdate (), INTERVAL-5 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-6 HOUR) union ALL Select DA Te_add (Curdate (), INTERVAL-7 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-8 HOUR) union ALL Select Date_add (curdate (), INTERVAL-9 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-10 HOUR) union ALL Select Date_add (Curdate (), INTERVAL -11 HOUR) UNION ALL Select Date_add (Curdate (), INTERVAL-12 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-13 HOUR) UNI On all Select Date_add (Curdate (), INTERVAL-14 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-15 HOUR) UNION ALL Selec T Date_add (Curdate (), INTERVAL-16 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-17 HOUR) union ALL Select Date_add (C Urdate (), INTERVAL-18 HOur) union ALL Select Date_add (Curdate (), INTERVAL-19 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-20 HOUR) union AL L Select Date_add (curdate (), INTERVAL-21 HOUR) union ALL Select Date_add (Curdate (), INTERVAL-22 HOUR) union ALL Select DAT E_add (Curdate (), INTERVAL-23 HOUR) UNION all SELECT Date_add (Curdate (), INTERVAL-24 HOUR) ORDER by TD) A

The past 11 hours today

Select TD as Showhourfrom (select Now () as tdunion all select Date_add (now (), INTERVAL-1 HOUR) UNION all select Date_add (N OW (), INTERVAL-2 HOUR) union ALL Select Date_add (now (), INTERVAL-3 HOUR) union ALL Select Date_add (now (), INTERVAL-4 HOUR ) UNION ALL Select Date_add (now (), INTERVAL-5 HOUR) union ALL Select Date_add (now (), INTERVAL-6 HOUR) union ALL Select DATE _add (now (), INTERVAL-7 HOUR) union ALL Select Date_add (now (), INTERVAL-8 HOUR) union ALL Select Date_add (now (), INTERVAL- 9 HOUR) UNION ALL Select Date_add (now (), INTERVAL-10 HOUR) union ALL Select Date_add (now (), INTERVAL-11 HOUR) ORDER by TD) A



Use the MySQL statistics page to access and rank

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.