Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL question on hierarchical data

Re: SQL question on hierarchical data

From: David Sisk <davesisk_at_ipass.net>
Date: 1998/10/07
Message-ID: <HwAS1.2910$yo1.55067256@news.ipass.net>#1/1

I think you're going to have to switch back to ORACLE comrade! :)

Sunil Godithi wrote in message ...
>hi,
>I have recently switched to SQL Server from oracle world and I am having
>problem with Select statement.
>
>I have a table called emp with structure like:
>EMPNO ENAME MGR
>
>MGR is the EMPNO of the manager. I need to get a list of employees like
 this
>(select statement is Oracle specific, I need something similar for
>SQLServer)...
>SQL> l
> 1 select level
> 2 , ename
> 3 , empno
> 4 , mgr
> 5 from emp
> 6 connect by prior empno = mgr
> 7* start with job = 'PRESIDENT'
>SQL> /
>
> LEVEL ENAME EMPNO MGR
> --------- ---------- --------- ---------
> 1 KING 7839
> 2 JONES 7566 7839
> 3 SCOTT 7788 7566
> 4 ADAMS 7876 7788
> 3 FORD 7902 7566
> 4 SMITHXX 7369 7902
> 2 BLAKE 7698 7839
> 3 ALLEN 7499 7698
> 3 WARD 7521 7698
> 3 MARTIN 7654 7698
> 3 TURNER 7844 7698
> 3 JAMES 7900 7698
> 2 CLARK 7782 7839
> 3 MILLER 7934 7782
>
>14 rows selected.
>
>Any help is appreciated..
>
>Sunil
>
>
>
Received on Wed Oct 07 1998 - 00:00:00 CDT

Original text of this message

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