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 |
derrellgore
Starting Member
6 Posts |
Posted - 2012-02-18 : 10:17:48
|
Can anyone tell me how to accomplish this?ACCOUNTINFOACCOUNT# SALESMANNUM NETTERMS111111 10 110222222 Null 130 333333 30 NullSalesmanSNUM NAME10 Jim20 Dan30 SteveNETINFONTERMS NETDAYS110 10130 30Result111111 10 Jim 110 10222222 Null Null 130 30333333 20 Dan Null Null |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-02-18 : 12:43:59
|
[code]SELECT a.[Account#], a.SALESMANNUM, b.[Name], a.NETTERMS, c.NETDAYSFROM AccountInfo a LEFT JOIN Salesman b ON a.SALESMANNUM = b.SNUM LEFT JOIN NETINFO c ON c.NTERMS = a.NETTERMS;[/code]Now that I am looking at it carefully, this query may not do what you want - not clear to me the logic used for the third row in the output. The query I posted would associate Steve with Account# 333333 |
 |
|
|
|
|