Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 9 Query Question.....Please help....
Mark D Powell wrote:
> Try making your query a subquery. You can then select the
> max(total_sales) where total_sales = unit*price
>
> select prodnum, max(total_sales) from ( your_query)
>
> HTH -- Mark D Powell --
Thanks for replying...
Like this?
SQL> select orderdetails.prodnum,max(total) as total_sales
2 from products,orderdetails
3 where products.prodnum=orderdetails.prodnum
4 and (select max(total) from
5 products,orderdetails
6 where products.prodnum=orderdetails.prodnum
7 and total = sum(unit*price))
8 order by orderdetails.prodnum;
and total = sum(unit*price))
*
ERROR at line 7:
ORA-00936: missing expression
However, as you can see, I get an error message. If I remove the "sum" it throws off the equation, and then the same error occurs but for line 8? I suspect it has to do with my table joins, but I am lost here.
Thoughts? Received on Sun Apr 16 2006 - 13:13:11 CDT