Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Joining the one column with two other columns
I post this question, becaz I couldn't get the expected result. I
thought some one has some ideas.
Why people bother commenting, if they can not provide the solution or direction?
Prince.
Mark.Powell_at_eds.com (Mark D Powell) wrote in message news:<2687bb95.0308211756.7d0cfb58_at_posting.google.com>...
> gspk_at_yahoo.com (Prince Kumar) wrote in message news:<629275ba.0308211417.3c7fc1ea_at_posting.google.com>...
> > Hi:
> >
> > I have the following two tables.
> >
> > SQL> desc t
> >
> > Name Type
> > -----------------------------------------
> > ----------------------------
> > RECORD# NUMBER PK_T (RECORD#)
> >
> > SQL> desc pp
> >
> > Name Type
> > -----------------------------------------
> > ----------------------------
> > PKEY NUMBER(8) FK references T
> > (record#)
> > RKEY NUMBER(8) FK references T
> > (record#)
> > AMOUNT NUMBER
> >
> > FK
> >
> > 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,
>
> Why post this question? Why not just run the query and see?
>
> HTH -- Mark D Powell --
Received on Fri Aug 22 2003 - 12:11:01 CDT
![]() |
![]() |