I need to figure out a way to pull a random sample of 5 calls per day per user.
TableA (ID INT, UserID INT, CallDate DATETIME, CallDesc VARCHAR(100))
So far:
select userid, callDesc
from TableA
where callDate between yesterday and today
order by NEWID()
But how can I pull just 5 recs per user? I need all users with calls to show up.
Thanks in Advance,
Dan
TableA (ID INT, UserID INT, CallDate DATETIME, CallDesc VARCHAR(100))
So far:
select userid, callDesc
from TableA
where callDate between yesterday and today
order by NEWID()
But how can I pull just 5 recs per user? I need all users with calls to show up.
Thanks in Advance,
Dan