The following User History table contains one record for every day a given user has accessed a website (in a 24 hour UTC period). It has many thousands of r
Doing this with a single SQL query seems overly complicated to me. Let me break this answer down in two parts.