HI I have a table that someone else designed like
*********************************************
* employeeid * firstname * last name * supervisor_id *
*********************************************
* 1 * Paul * Sed * 2
*
*********************************************
* 2 * John * Edward * 1 *
*********************************************
I need a query that will return Johns name for Pauls supervisor
(supervisorid=2)
and Pauls name for Johns supervisor, supervisor id for Johns supervisor is 1
which is the employeeid for Paul. Thanks.
--
Paul G
Software engineer.Why is it that these two people are each other's supervisor?
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:924257B5-2D18-4C2F-84F5-8C9C7BAA2AEC@.microsoft.com...
HI I have a table that someone else designed like
*********************************************
* employeeid * firstname * last name * supervisor_id *
*********************************************
* 1 * Paul * Sed * 2
*
*********************************************
* 2 * John * Edward * 1 *
*********************************************
I need a query that will return Johns name for Pauls supervisor
(supervisorid=2)
and Pauls name for Johns supervisor, supervisor id for Johns supervisor is 1
which is the employeeid for Paul. Thanks.
--
Paul G
Software engineer.|||select t.FirstName,t.LastName,b.FirstName as 'Supervisor FirstName',
b.LastName as 'Supervisor FirstName' from
#temp t join #temp b
on b.employeeid=t.supervisor_id
#temp =Table Name
Sam
"Tom Moreau" wrote:
> Why is it that these two people are each other's supervisor?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> ..
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:924257B5-2D18-4C2F-84F5-8C9C7BAA2AEC@.microsoft.com...
> HI I have a table that someone else designed like
> *********************************************
> * employeeid * firstname * last name * supervisor_id *
> *********************************************
> * 1 * Paul * Sed * 2
> *
> *********************************************
> * 2 * John * Edward * 1 *
> *********************************************
> I need a query that will return Johns name for Pauls supervisor
> (supervisorid=2)
> and Pauls name for Johns supervisor, supervisor id for Johns supervisor is 1
> which is the employeeid for Paul. Thanks.
> --
> Paul G
> Software engineer.
>|||this is actually not the case, just a simplified example.
--
Paul G
Software engineer.
"Tom Moreau" wrote:
> Why is it that these two people are each other's supervisor?
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Columnist, SQL Server Professional
> Toronto, ON Canada
> www.pinpub.com
> ..
> "Paul" <Paul@.discussions.microsoft.com> wrote in message
> news:924257B5-2D18-4C2F-84F5-8C9C7BAA2AEC@.microsoft.com...
> HI I have a table that someone else designed like
> *********************************************
> * employeeid * firstname * last name * supervisor_id *
> *********************************************
> * 1 * Paul * Sed * 2
> *
> *********************************************
> * 2 * John * Edward * 1 *
> *********************************************
> I need a query that will return Johns name for Pauls supervisor
> (supervisorid=2)
> and Pauls name for Johns supervisor, supervisor id for Johns supervisor is 1
> which is the employeeid for Paul. Thanks.
> --
> Paul G
> Software engineer.
>|||ok thanks I think that is what I was looking for.
--
Paul G
Software engineer.
"bluefish" wrote:
> select t.FirstName,t.LastName,b.FirstName as 'Supervisor FirstName',
> b.LastName as 'Supervisor FirstName' from
> #temp t join #temp b
> on b.employeeid=t.supervisor_id
> #temp =Table Name
> Sam
>
> "Tom Moreau" wrote:
> > Why is it that these two people are each other's supervisor?
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Columnist, SQL Server Professional
> > Toronto, ON Canada
> > www.pinpub.com
> > ..
> > "Paul" <Paul@.discussions.microsoft.com> wrote in message
> > news:924257B5-2D18-4C2F-84F5-8C9C7BAA2AEC@.microsoft.com...
> > HI I have a table that someone else designed like
> > *********************************************
> > * employeeid * firstname * last name * supervisor_id *
> > *********************************************
> > * 1 * Paul * Sed * 2
> > *
> > *********************************************
> > * 2 * John * Edward * 1 *
> > *********************************************
> > I need a query that will return Johns name for Pauls supervisor
> > (supervisorid=2)
> > and Pauls name for Johns supervisor, supervisor id for Johns supervisor is 1
> > which is the employeeid for Paul. Thanks.
> >
> > --
> > Paul G
> > Software engineer.
> >
> >
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment