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: Aggregation query in Oracle

Re: Aggregation query in Oracle

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: Tue, 19 Jul 2005 15:54:04 +0000 (UTC)
Message-ID: <dbj7ms$2ch$2@klatschtante.init7.net>


On 2005-07-19, bhaskarjain_at_gmail.com <bhaskarjain_at_gmail.com> wrote:
> have four queries Test, Test1, Test2, Test4 all of them having same
> number of columns and same datatype
>
>
> Test results in following columns
> Refrence_Num
> First_Name
>
>
> Test1 results in following columns
> Refrence_Num
> Middle_Name
>
>
> Test2 results in following columns
> Refrence_Num
> Last_Name
>
>
> Test3 reults in following columns
> Refrence_Num
> Nationality
>
>
> I have to join these four queries in such a way that I get following
> columns in the result and for Refrence_Num I have only one row having
> all the data.
>
>
> Refrence_Num
> First_Name
> Middle_Name
> Last_Name
> Nationality
>
>
> I don't want to create a temporary table or PL/SQL for this

Why don't you post the create table statements?

Anyway, use something like

select
  Refrence_Num,
  First_Name,
  Middle_Name,
  Last_Name,
  Nationality
from

  (select test) join (select test1) using (Refrence_Num)
                join (select test2) using (Refrence_Num)
                join (select test3) using (Refrence_Num)
;

hth
Rene

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch/
Received on Tue Jul 19 2005 - 10:54:04 CDT

Original text of this message

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