I’m trying to do something like
SELECT `v1`.`date`, COUNT(DISTINCT(`v2`.`id`)) AS `visits`
FROM `visitor_visits` AS `v1` JOIN `visitor_visits` AS `v2`
ON (`v1`.`date` = `v2`.`date`) GROUP BY `v1`.`date`, `v2`.`date`
ORDER BY `v1`.`date
To get distinct dates, and a count of all other dates that match.
I’m pretty sure this is the wrong query since the date column is non-unique.
What’s wrong with:
?
ps. I assume that
idis primary key (unique).