开发者

Get Uniqie views and views in one SQL query

开发者 https://www.devze.com 2023-04-11 18:34 出处:网络
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.

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

精彩评论

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