Jesper writes "Hi Put in plain terms what I would like to do is to be able to is this. Say I had a branch network of something and that I had customerdata for these offices and that I would like to know (in this case) who the top 75% of my customers where..... How would I get by doing that?I would like to be able to select rows in a group by clause based onother rows and some sort of a running percentage total. I have no ideahow to accomplish this in SQL but I am sure there is a fairly simpleway of doing it.Basically what I would like to do is:Key1, Key2, Contrib1, 1, 2.3451, 2, 3.4501, 3, 4.6572, 1, 3.7892, 2, 4.2142, 3, 3.9873, 1, 2.0983, 2, 1.7893, 3, 2.345
Key1 (1) one receives a total contribution of (2.345 + 3.450 + 4.657)=10.452 from Key2 (1,2,3)I would like to create something that would select the "top" 75%contribution from Key2 grouped by key1.... I am using SQL server2000 EE on W2K Advanced Server SP1.....Result Set: Key1, Key21, 32, 22, 33, 33, 1
Is this possible using SQL?Any help would be greatly appreciated..../Jesper"