I'm adding 1 view for the page every time it refreshes. I'm storing page_id, user's ip, and browser agent.
I want to select and count only unique visits.
So I have tried:
SELECT COUNT(id) as visits FROM sh_page_visits GROUP BY ip_address
But it returns 4 instead of 1.
How can I do this?
I suspect that you want:
select count(distinct ip_address) from sh_page_visits
This counts how many distinct ip addresses have visited the site - which is how I understood your question.