sorry, table. And thanks, but that code doesn't seem to be working. If it helps, I'm using an old copy of Toad (version 6.3.11.1 g)I've pasted the code I used below. The inside query works fine by itself, but when I try to run it with the top function I get this error: "ORA-00923: FROM keyword not found where expected" and it highlights the number 10SQL:select top 10 *from ( select p.needle_rmc RMC, round(avg(case when c.cpl < c.cpk then c.cpl else c.cpk end), 2) Cpk from newcim.new_work_orders N, newcim.new_product_specs P, newcim.cpk c where n.work_ord = c.work_ord and n.item_cd = p.item_cd and n.item_rev = p.item_rev and n.start_date >= To_date('01/01/2007','MM/DD/YY') and n.end_date <= To_date('06/04/2007','MM/DD/YY') and n.work_ctr NOT LIKE 'SOT%' group by p.needle_rmc order by cpk )order by RMC