Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Oracle 9 Query Question.....Please help....
Lets say I had to find the products for which we had a total of $500 or more
in sales. I need to see the following information:
· product number
· total sales (in dollars)
· product name
So.I write this..
SQL> select orderdetails.prodnum,sum(unit*price)
2 from products,orderdetails
3 where products.prodnum=orderdetails.prodnum
4 having sum(unit*price) > 500
5 group by orderdetails.prodnum;
And it produces the correct output:
PRODNUM SUM(UNIT*PRICE)
1267 968.58
1794 600
1239 30344.13
2711 399.95
Given this, how can I find the product that had the highest total sales (you can use
your answer to the "easy" part). Output should include the same as for the previous part, with exactly the following:
PRODNUM TOTAL
1239 30344.13
Could someone help me with this? It's just a practice exercise, but I don't know how to write the query..If you require more info, please let me know.
Thank you in advance for reading, and for your help... Received on Sun Apr 16 2006 - 12:08:01 CDT