程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> MySQL頁面訪問統計及排名情況,mysql訪問統計排名

MySQL頁面訪問統計及排名情況,mysql訪問統計排名

編輯:MySQL綜合教程

MySQL頁面訪問統計及排名情況,mysql訪問統計排名


MySQL頁面訪問統計及排名情況

統計訪問頁面數量,以分辨率進行排名

SELECT CONCAT(`height` , '*', `width`) AS `resolution` , COUNT(CONCAT(`height`, '*', `width`)) AS `total` 
FROM `wifi_status_page` 
GROUP BY CONCAT(`height`, '*', `width`) 
ORDER BY `total` DESC 
LIMIT 0 , 30 

最近7天頁面訪問量,每日統計數量,以日期為序

SELECT td AS showdate, COALESCE( totalcount, 0 ) AS totalcount 
FROM ( 
SELECT CURDATE( ) AS td 
UNION ALL SELECT DATE_ADD( CURDATE( ) , 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 ) 
ORDER BY td 
)a 
LEFT JOIN ( 
SELECT FROM_UNIXTIME(add_time, '%Y-%m-%d') add_data, COUNT( id ) AS totalcount 
FROM wifi_status_page 
WHERE FROM_UNIXTIME(add_time, '%Y-%m-%d') BETWEEN DATE_ADD(CURDATE(), INTERVAL -6 DAY) AND CURDATE() 
GROUP BY add_data 
)b ON a.td = b.add_data 

最近30天頁面訪問量,每日統計數量,以日期為序

SELECT td AS showdate, COALESCE( totalcount, 0 ) AS totalcount 
FROM ( 
SELECT CURDATE( ) AS td 
UNION ALL SELECT DATE_ADD(CURDATE(), 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 SELECT DATE_ADD(CURDATE(), INTERVAL -11 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -12 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -13 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -14 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -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 SELECT DATE_ADD(CURDATE(), INTERVAL -20 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -21 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -22 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -23 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -24 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -25 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -26 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -27 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -28 DAY) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -29 DAY) 
ORDER BY td 
)a 
LEFT JOIN ( 
SELECT FROM_UNIXTIME(add_time, '%Y-%m-%d') add_data, COUNT( id ) AS totalcount 
FROM wifi_status_page 
WHERE FROM_UNIXTIME(add_time, '%Y-%m-%d') BETWEEN DATE_ADD(CURDATE(), INTERVAL -29 DAY) AND CURDATE() 
GROUP BY add_data 
)b ON a.td = b.add_data 

昨天24小時分時

SELECT td AS showhour 
FROM ( 
SELECT DATE_ADD(CURDATE(), INTERVAL -1 HOUR) as td 
UNION 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 DATE_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) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -14 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -15 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -16 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -17 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -18 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -19 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -20 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -21 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -22 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -23 HOUR) 
UNION ALL SELECT DATE_ADD(CURDATE(), INTERVAL -24 HOUR) 
ORDER BY td 
)a 

今天過去的11個小時

SELECT td AS showhour 
FROM ( 
SELECT NOW() AS td 
UNION ALL SELECT DATE_ADD(NOW(), INTERVAL -1 HOUR) 
UNION ALL SELECT DATE_ADD(NOW(), 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 

以上所述是小編給大家分享的MySQL頁面訪問統計及排名情況,希望對大家有所幫助。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved