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

Home -> Community -> Usenet -> c.d.o.server -> Re: Joining the one column with two other columns

Re: Joining the one column with two other columns

From: Prince Kumar <gspk_at_yahoo.com>
Date: 22 Aug 2003 14:56:01 -0700
Message-ID: <629275ba.0308221356.7fa96ccb@posting.google.com>


Thanks Dave for your response.

Currently, I have something similar to the one you have posted. I was wondering whether it can be achieved using one select and joins (academic interest).

Prince.

treschaud33_at_yahoo.com (Dave Michaud) wrote in message news:<89e2b272.0308221012.40b6e16f_at_posting.google.com>...
> gspk_at_yahoo.com (Prince Kumar) wrote in message news:<629275ba.0308211417.3c7fc1ea_at_posting.google.com>...
>
> >
> > I have the two sqls.
> > ===================
> > select sum(pp.amount) as ptot from pp, t where pp.pkey = t.record#
> >
> > select sum(pp.amount) as rtot from pp, t where pp.rkey = t.record#
> >
> >
> > I am wondering whether "ptot" and "rtot" can be abtained in the same
> > select statement (ie, in the above I have two SQLs to get the result,
> > can I get the same using just ONE SELECT statement?)
> >
> > something like
> > "select sum(pp.amount) ptot, sum(pp1.tot) rtot from pp, pp pp1 ..."
> >
> > Thanks,
>
> Since you only have two seperate queries the following will work.
>
> Select ptot, rtot
> from (select sum(pp.amount) as ptot from pp, t where pp.pkey = t.record#) A,
> (select sum(pp.amount) as rtot from pp, t where pp.rkey = t.record#) B
>
> Dave
Received on Fri Aug 22 2003 - 16:56:01 CDT

Original text of this message

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