SQL Query - Ranking / Distribution
Posted on 2012-03-22
SQL Server 2008 R2. I have a table with 3 relevant columns:
[FileName], [FileSize], [Group]
I'd like break up the recordset up into groups based on the even distribution of [FileSize];
If I decided to break the recordset into 5 groups I would set [Group] to either '1','2','3','4' or '5' and I would expect the SUM([FileSize]) for each group to be similar.
I can think of some round-about ways of accomplishing this but want to know if there is an elegant way to do so.