where clause help, please
From: Totti <saliba.toufic.george_at_gmail.com>
Date: Wed, 2 Jan 2008 15:12:07 -0800 (PST)
Message-ID: <67ee82a4-00e2-473e-a87b-f26b6cd3d4bb@e23g2000prf.googlegroups.com>
Date: Wed, 2 Jan 2008 15:12:07 -0800 (PST)
Message-ID: <67ee82a4-00e2-473e-a87b-f26b6cd3d4bb@e23g2000prf.googlegroups.com>
hi all,
i want to get the top 3 product that are the most sold, i want to use
in the where clause, rowNum <= 3 but i dont know what is the exact
syntax, my attempt is this:
select Prod_Code , sum(qty) from purch
group by Prod_Code
order by sum(qty) desc
and from this i want just the first 3, rowNum will do the thing in where but would you please tell me how to imply it properly?
thanks. Received on Wed Jan 02 2008 - 17:12:07 CST