日期:2014-05-19  浏览次数:20711 次

实现统计人数
我的数据库里已经得到了IP地址、访问时间。怎么根据这些统计总访问量,当前访问量和今天的访问量


------解决方案--------------------
今天的访问量 这个简单呀,select count(*) from 带IP的表 where 时间=今天 (去掉重复的IP)
------解决方案--------------------
总访问量: select count(*) from table
当前访问量:select count(*) from table where 时间 =当前
今天的访问量: select count(*) from table where 时间 between 昨天 and 今天

------解决方案--------------------
distinct 关键字
------解决方案--------------------
select count(*) from ( Select distinct ip table)