Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pmaple66
Starting Member
2 Posts |
Posted - 2005-04-19 : 17:49:33
|
| Hey All, I'm having problems with this Query. I have a DB that I'm writing a query through MS SQL enterprise Manager. Majorly simplfied here it is:Table contains three columns, employeeid employeeLastName, supervisoridEvery employee has a supervisor assigned to them. That supervisor id is also located in the employeeid column, just in a different area, example:employeeid: employeeLastName supervisorid125263 Smith 125266125266 Jones 124423The end user wants to know the supervisor's last name not the id. Ive bunch of different things, but I am a newbie to sql. Basically I want to do something that says if supervisorid IN employeeid display supervisorid. Ive tried unions, a sub select statement, but I'm always off somewhat. I have access to do anything I want on the DB. Can someone point me in the right direction? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-04-19 : 17:54:15
|
| SELECT e1.EmployeeID, e1.EmployeeLastName, e2.EmployeeLastNameFROM Employee e1INNER JOIN Employee e2ON e1.SupervisorID = e2.EmployeeIDTara |
 |
|
|
pmaple66
Starting Member
2 Posts |
Posted - 2005-04-20 : 12:06:57
|
| That was it! Thank you!!!!!!!!!!!!!!!! |
 |
|
|
|
|
|