开发者

Get Uniqie views and views in one SQL query

I would like to retrive uniqie views and views in a single query. My current query to retrive views looks like this, but i would also like to retrieve unique views with it.

The field to the IP address is called IP

SELECT `time` - `time` % 86400 AS Date, count(*) AS Views 
    FROM `bvcms_pagevi开发者_C百科ews` 
    WHERE 1=1 
    GROUP BY Date

Best regards


Unique IP view data? Selected 'Distinct' would help with this

 SELECT DISTINCT IP, `time` - `time` % 86400 AS Date, count(IP) AS
 Views FROM `bvcms_pageviews` WHERE 1=1 GROUP BY Date

http://www.sql-tutorial.com/sql-distinct-sql-tutorial/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜