Reputation: 63
I am trying to preserve the structure of the results and replace the player id's with player firstnames. IE I want the nulls to stay where they are to preserve the ordering. see below:
Step 1) replace FK_WinnerID with FirstName and preserve the nulls.
Problem is sql statement is removing nulls
This is what it should look like:
Upvotes: 0
Views: 44
Reputation: 52645
When you have
FROM A LEFT JOIN B
That means you want everything in A
and matching records in B
But you want everything from B
and matching records in A
so you need to do either
FROM B LEFT JOIN A
OR
FROM A RIGHT JOIN B
Upvotes: 2
Reputation: 63
SELECT FirstName
FROM Players right join TournamentPrizes
ON Players.PlayerID = TournamentPrizes.FK_WinnerID
WHERE FK_TournamentID=1043
order by TournamentPrizes.Place ASC
Upvotes: 0