0

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.

enter image description here

Problem is sql statement is removing nulls

enter image description here

This is what it should look like:

enter image description here

1
  • 1
    Use a RIGHT join instead of a LEFT Commented Dec 5, 2013 at 23:34

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0
SELECT FirstName
FROM Players right join TournamentPrizes
ON Players.PlayerID = TournamentPrizes.FK_WinnerID
WHERE FK_TournamentID=1043 
order by TournamentPrizes.Place ASC

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.