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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Oracle Subquery Question

Re: Oracle Subquery Question

From: Prasanna Meda <mlp_at_cup.hp.com>
Date: Thu, 22 Feb 2001 17:27:24 -0800
Message-ID: <3A95BC7C.FE9090A0@cup.hp.com>

Hi,
 I don't know Oracle.I just signed in to learn moreofit.  I am answering this with little intution and bookish knowledge.  

 Select - returns a table.
 Arguments of select - fields(columns)
 Here inner 'select;(i.e. subquery) returns a table,may be it is  single column,single rowed one.
 Other solutions suggested here are putting subquery  in part 'from' clause.Those are syntatically okay.They will be joined  there.one of the table can be a subquery.  Select field,field..
 where (cond)
 from table,table...
Thanks,
MLPKR. SL wrote:
>
> Same error. If I execute the subquery directly, 'SELECT
> sum(qty_onhand) FROM inventory_part_tab a, inventory_part_location_tab
> b WHERE a.part_no = b.part_no', it works fine.
>
> On Tue, 23 Jan 2001 03:15:57 +0100, "jean-marc pyrée"
> <jmpyree_at_club-internet.fr> wrote:
>
> >Try:
> >
> >select a.part_no,
> >(SELECT sum(qty_onhand) FROM inventory_part_location_tab b
> > WHERE a.part_no = b.part_no)
> > from inventory_part_tab a
> >group by a.part_no
> >
> >
> >
> ><z2124_at_my-deja.com> a écrit dans le message news:
> >94imcv$mhq$1_at_nnrp1.deja.com...
> >> I am having a problem with what should be a simple query. The
> >> following query is returning a ORA-00936, 'Missing Expression' error
> >> message.
> >>
> >> select a.part_no,
> >> (SELECT sum(qty_onhand) FROM inventory_part_location_tab b
> >> WHERE a.part_no = b.part_no)
> >> from inventory_part_tab a
> >>
> >> I am trying to return two fields, part_no and a sum of quantities.
> >> What am I missing?
> >>
> >> TIA
> >>
> >>
> >> Sent via Deja.com
> >> http://www.deja.com/
> >
> >
Received on Thu Feb 22 2001 - 19:27:24 CST

Original text of this message

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