I have a table (statistics) with the columns User, Date (datetime), Page and IP.
I have this query:
SELECT * FROM statistics WHERE page LIKE '%page_name' ORDER BY date DESC LIMIT 30.
That’s ok to display all the user that visited that page. But I would like to display unique ips per day, something like DISTINCT ip (per day)
I don’t know how to add the ‘per day’ part…
any ideas? 🙂
If you want to show the amount of unique IPs you can use MySQL’s GROUP BY:
If you want a list of all the unique IPs per date, you need to group them after you’ve retrieved them all, e.g.