I have a query that is looking at a 'page_views' table. And I so far have the ability to get the total views by day. However, I am having an issue with getting unique views by day.
The column I am testing against is user_id... Here's the query I have for total views.
SELECT
site_id,
CONCAT( month(created_at)
, '-'
, day(created_at)
, '-'
, year(created_at)
) as created_at_date,
COUNT(*) as total_results
FROM
page_views
GROUP BY day(created_at)
I can't figure out the logic to just get the total unique views by day unique being based on the user_id column.
Schema:
id:int
user_id:int
site_id:int
request_uri:varchar
referer:varchar
user_agent:varchar
created_at:datetime