Vinne, that will give you the top 20% salesmen.OP wanted which salesmen generate the top 20% of the sales...This is the test datadeclare @sales table (empid int, sales money)insert @salesselect 100, 200 union allselect 101, 550 union allselect 102, 200 union allselect 103, 125 union allselect 104, 500 union allselect 105, 300 union allselect 106, 400 union allselect 107, 215select t1.empid, t1.sales, (select sum(t2.sales) from @sales t2 where t2.sales >= t1.sales) accfrom @sales t1order by t1.sales desc, t1.empid
How will 20% of 2490 (498 dollars) be compared to sales?Peter LarssonHelsingborg, Sweden