Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 9 Query Question.....Please help....

Re: Oracle 9 Query Question.....Please help....

From: Baba Boohi <BooeyBooey_at_yahoo.com>
Date: Sun, 16 Apr 2006 14:13:11 -0400
Message-ID: <K_SdnaLE7NWAGt_ZnZ2dnUVZ_uidnZ2d@adelphia.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US