I have a query that should be able to join the field left in the right place, given the condition that the field is equal to a variable.
Sort of:
CASE WHEN challenges.userID = $var LEFT JOIN challengesRead ON challenges.userID = challengesRead.userID CASE WHEN challenges.opponentID = $var LEFT JOIN challengesRead ON challenges.opponentID = challengesRead.userID
I think I'm on the right track, but I'm not sure how to put the request together. Thanks
source share