I have a SQL query that left joins a table in different ways depending on a condition.
SELECT m.id, u.first_name AS otherUser FROM matches AS m IF (u.id=m.user2I
You can also have two LEFT JOIN on the same table like this...
LEFT JOIN
LEFT JOIN users AS u ON u.id = m.user1ID LEFT JOIN users AS u2 ON u2.id = m.user2ID
This is an alternative to using IF statements.