统计数据-网站统计的sql代码

嗯,这里是简介,主题配置内可以修改,如留空则不显示

统计数据-网站统计的sql代码

作为网站统计的sql代码

select * from blkq_visit limit 5;

select *,to_days(create_time),count(*) count
from blkq_visit
where (to_days(now())-to_days(create_time) = 1)
group by create_time;

-- pv
select DATE_FORMAT(create_time,'%Y-%m-%d') days,count(*) count
from blkq_visit
where (to_days(now())-to_days(create_time))<7
group by to_days(create_time);

-- uv
select DATE_FORMAT(create_time,'%Y-%m-%d') days,count(distinct ip)
from blkq_visit
where (to_days(now())-to_days(create_time))<7
group by to_days(create_time);

-- 最多的访问来源
select from_site,count(from_site) count
from blkq_visit
where (to_days(now())-to_days(create_time))<7
group by from_site
order by count desc;

-- 是个ip
select distinct ip,'d' address
				from blkq_visit
				where (to_days(now())-to_days(create_time))<7
				order by create_time desc
				limit 10;

-- page
select id,title,read_num
from blkq_page
order by read_num+0 desc;


发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Hello world. 豫ICP备16008819号-1.

Power by Z-BlogPHP  Theme by wzdaxue