I have a table, SCCalls, which has a column Call_CalT_Code. Call_CalT_Code can be one of several different values. It also has a column Call_InDate which I will be filtering by.
I need to get 1000 random records (filtered by Call_InDate) in total, distributed equally number for each Call_CalT_Code.
How can I do this?
Edit (gbn): solution has to work on a database that is compatibility mode 80 on SQL Server 2005
You may need to play around with the numbers in the division.
If you have 9 values, then 1000/9 = 111 so you’d only get 999 rows back. So I used 1100 and a later TOP 1000.