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 |
|
ladiaocb
Yak Posting Veteran
57 Posts |
Posted - 2005-05-19 : 16:15:27
|
| I have 2 tables that look like:tbl1orgid parentid10 111 112 213 2tbl2orgid username1 Bill 2 Steve10 John11 Larry12 Joe13 MarkI want to return the following value:Result:Agent SupervisorJohn BillLarry BillJoe SteveMark SteveAny ideas? |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-05-19 : 16:35:52
|
Select Agent=B.username, Supervisor=C.usernameFrom tbl1 AInner Join tbl2 BOn A.orgId = B.orgIdInner Join tbl2 COn A.parentId = C.orgIdCorey Secret Service Agent: Mr. President, you're urinating on me.President Lyndon Johnson: I know I am. It's my prerogative. |
 |
|
|
ladiaocb
Yak Posting Veteran
57 Posts |
Posted - 2005-05-19 : 16:46:59
|
| Sweet! This worked great. |
 |
|
|
|
|
|