Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Joining the one column with two other columns
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 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, Received on Thu Aug 21 2003 - 17:17:37 CDT