Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Join problem 1

Status
Not open for further replies.

brownfox

Programmer
Jan 5, 2003
173
GB
Can anyone help me with a join query?
Table 1:"players_round1"
Code:
[img]http://www.london-net.net/images/players_round1.gif[/img]
the values for White And Black are the primary key (ID) in table 2: "newPlayers"."
Code:
[img]http://www.london-net.net/images/newPlayers.gif[/img]
I want a query that will show "players_round1" with the LastName from "newPlayers" in place of the integers that are in the columns "White" & "Black". It's driving me mad but this can't be that hard to do! Thanks in advance...
 
Something like this ?
SELECT R.ID, W.LastName As WhiteName, B.LastName As BlackName
FROM (players_round1 R
LEFT JOIN newPlayers W On R.White=W.ID)
LEFT JOIN newPlayers B On R.Black=B.ID

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top