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 Hierachical SELECT

Re: SQL Hierachical SELECT

From: Jerry Gitomer <jgitomer_at_hbsrx.com>
Date: Thu, 3 Jun 1999 13:28:56 -0400
Message-ID: <7j6dq0$jo4$1@autumn.news.rcn.net>


Hi Rose,

    Yes.

    SELECT * FROM emp
    WHERE empno = '7765'

             OR empno = (SELECT mgr FROM emp WHERE empno = '7765');

This will return the two rows containing the information about Scott and about Scott's Manager. If you want to see all of the information for everyone in the department, except for the manager use the following:

    SELECT * FROM emp
    WHERE empno = '7765'

             OR mgr = (SELECT mgr FROM emp WHERE empno = '7765');

regards

Jerry Gitomer


Rose Noel wrote in message <3755C067.2EDE9D5C_at_easynet.co.uk>...
>Hello everybody,
>I am trying to select some employee data from emp table without using
>the "CONNECT BY CLAUSE". Is it this possible using only SQL.
>Empno Ename Mgr
>7765 Scott 7788
>7788 Jones 7839
>
>This is the result of executing the query. I know Scott's EMPNO and I
>want his details and that of his manager. How can this be done in sql
>Cheers
>RNK.
Received on Thu Jun 03 1999 - 12:28:56 CDT

Original text of this message

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