当前位置:主页 > mysql教程 > MySQL页面访问统计及排名情况

关于MySQL页面访问统计与排名

发布:2020-01-13 21:53:16 75


为找教程的网友们整理了MySQL页面访问统计与排名相关的编程文章,网友庄飞绿根据主题投稿了本篇教程内容,涉及到MySQL、页面访问、统计及排名、MySQL页面访问统计及排名情况相关内容,已被586网友关注,涉猎到的知识点内容可以在下方电子书获得。

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页面访问统计及排名情况,希望对大家有所帮助。


参考资料

相关文章

  • Oracle和MySQL的高可用方案对比及用法详解

    发布:2020-07-26

    这篇文章主要介绍了Oracle和MySQL的高可用方案对比分析,非常不错,具有参考借鉴价值,需要的朋友可以参考下


  • mysql缓冲和缓存设置详细步骤

    发布:2020-01-06

    本文主要给大家讲解的是mysql优化过程中比较重要的2个参数缓冲和缓存的设置,希望大家能够喜欢


  • MySQL升级的实战详解

    发布:2020-01-04

    这篇文章给大家从理论到实战详细分享了MySQL升级的最佳方法,有需要的朋友跟着学习操作下吧。


  • mysql字符串函数收集比较全

    发布:2022-06-17

    给网友朋友们带来一篇关于mysql的教程,mysql 字符串函数收集,需要的朋友可以参考下。


  • Python实现MySql数据库交互的示例

    发布:2023-03-02

    本文主要介绍了Python实现MySql数据库交互的示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧


  • mysql grants知识点浅析

    发布:2021-05-09

    grant命令是对mysql数据库进行用户创建,权限或其他参数控制的强大的命令,官网上介绍它就有几大页,要用精它恐怕不是一日半早的事情,权宜根据心得慢慢领会吧!


  • SUSE Linux下通过RPM方式卸载MySQL 5过程笔记

    发布:2022-07-04

    给网友们整理关于Linux的教程,这篇文章主要介绍了SUSE Linux下通过RPM方式卸载MySQL 5过程笔记,本文针对使用rpm方式安装的mysql,需要的朋友可以参考下


  • 实例详解Mysql行级锁的使用及死锁的预防

    发布:2020-03-16

    mysql的InnoDB,支持事务和行级锁,可以使用行锁来处理用户提现等业务。使用mysql锁的时候有时候会出现死锁,要做好死锁的预防。这篇文章通过实例应用给大家讲解


网友讨论