I think something like this is what you're looking for:
(my Oracle knowledge isn't too deep, but it looks like you're just grabbing
all employees that are managers)

select e.emp_id, e.mgr_emp_id
from persons e
join persons m
on m.mgr_emp_id = e.prior_emp_id


----- Original Message -----
From: "Levi Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 04, 2001 4:52 PM
Subject: Oracle hierarchical (connect by) queries


> Hi,
> Does anyone know if SQL Server has an equivalent to Oracle's 'hierarchical
> queries'?
>
> Oracle Example:
> select emp_id, mgr_emp_id
> from persons
> start with emp_id = 123456
> connect by prior_emp_id = mgr_emp_id
>
> Looking for a way to do this in SQL Server.
>
> Thanks!
>
> Levi
>
>
>
> =====
> Levi Taylor
> <cf_coldfusion_developer>
> http://www.esoftsolutions.com
>
> __________________________________________________
> Do You Yahoo!?
> Buy the perfect holiday gifts at Yahoo! Shopping.
> http://shopping.yahoo.com
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to