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: Sql problem( select statement)

Re: Sql problem( select statement)

From: terryg8 <trg_at_ibm.net>
Date: 1997/07/23
Message-ID: <33D6A1BA.2D8A@ibm.net>#1/1

Abiy Alemu wrote:
>
> Is it possible to have on one row, values from father and son tables(dept
> and emp tables for ex.)
>
> Example
>
> col1 col2 col3 col4 col5
> Accounting king clark miller
> Research Blake Ford Smith Adams
> ... and so on
>
> where Accounting and Research are from the DEPT table and the remaining
> values are from EMP table.
>
> Thank you
> |-----------------------------------------------------------------------------|
> | If the only tool you have is a | Abiy Alemu abiy_at_biotec.jouy.inra.fr |
> | hammer, everything in the world | 9, avenue calmels |
> | seems like a nail.____________________| 92270 Bois colombes (France)________|

You can rig something with multiple instances of the "son" table in the "from" clause if you know a limit on the number of "sons" i.e. select dept_name,e1.emp_name,e2.emp_name,e3.emp_name

     from Dept, Emp e1,Emp e2,Emp e3
     where ...

BUT
that's kinda tiring. Why not use PL/SQL, and dbms_output? You can string together any number of "sons" for a given father and output on one line. (Apologies if you haven't got access to PL/SQL.) Cheers,
Terry Received on Wed Jul 23 1997 - 00:00:00 CDT

Original text of this message

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