Re: JOINing the same table
From: Wally (sgb_paul_at_yahoo.com)
Date: 02/07/05
- Next message: Wally: "Re: JOINing the same table"
- Previous message: David Portas: "Re: In(@variable) clause and TABLE datatype variable"
- In reply to: Query Builder: "Re: JOINing the same table"
- Messages sorted by: [ date ] [ thread ]
Date: 7 Feb 2005 14:58:41 -0800
Query Builder wrote:
> Are you saying you have a primary key that is been referenced as a
> foreignkey in the same table? WHYyyyy?? Anyways, to solve your
problem
> for now, here is the query......
No... there is no actual reference between the fields. As far as SQL
Server is concerned, pk_SupervisorID is an indexed primary key......
and fk_SupervisorID is just another unreferenced column with data in
it. The relation of the two fields only occurs in reports that the
front-end calls for.
> select E.LastName as EmpLastName,
> (Select LastName as SupLastName from Employees
> Where employeeID = E.SupervisorID)
> from Employee E
FYI: Your SELECT statement worked fine, but for some odd reason it
didn't label the SupLastName field.
Thanks!
- Next message: Wally: "Re: JOINing the same table"
- Previous message: David Portas: "Re: In(@variable) clause and TABLE datatype variable"
- In reply to: Query Builder: "Re: JOINing the same table"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|