Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SPOOKY SQL
Have you tried
select * from (
SELECT PRODUCT_ID, PRODUCT_DESCRIPTION, SUM(QUANTITY)
FROM ORDER_DETAILS
GROUP BY PRODUCT_ID, PRODUCT_DESCRIPTION
ORDER BY 3 )
where rownum < 6
--
Terry Dykstra (TeamSybase)
Canadian Forest Oil Ltd.
Oracle Developer wrote in message <37454574.D23CC37E_at_easynet.co.uk>...
>Hello,
>I am trying trying to write a select statement that will return five top
>selling products from a database table. The base table is the
>ORDER_DETAILS table which includes the product identity and the quantity
>sold. So I want to
>SELECT PRODUCT_ID, PRODUCT_DESCRIPTION, SUM(QUANTITY)
>FROM ORDER_DETAILS
>GROUP BY PRODUCT_ID, PRODUCT_DESCRIPTION
>ORDER BY 3;
>
>The above will return all the products and quantity sold. How do I
>limit it to the top five best sellers.
>Thanks in advance.
>RNK.
Received on Fri May 21 1999 - 10:50:15 CDT
![]() |
![]() |