I tried something like this
select Id,UserId from myTable group by Id,UserId having COUNT(UserId)<7
Now what i want to do is selecting 6 records for each userid. But my approach failed.
So what is the correct syntax ?
Id is primary key clustered index
This should get you pretty close