Given a set of random numeric values in a database, how do I generate a limited list of ranges where each range contains at least one value? The ranges should not overlap and ideally have a similar amount of values in them. Ideally their boundaries should also be multiples of 10, 100, 1000 etc...
For example:
Values: 100,150,180,300,400,500,600,650,700 results in 4 ranges: 100-180(2), 180-300(1), 300-600(3), 600-800(3)
How could this be done in C# or T-SQL?
Thanks