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
Spencer almost did it, but this should be the working code:
SELECT DISTINCT UserId
FROM History h1
WHERE (
SELECT COUNT(*)
FROM History
WHERE UserId = h1.UserId AND CreationDate BETWEEN h1.CreationDate AND DATEADD(d, @n-1, h1.CreationDate)
) >= @n