The trouble I'm having is trying to get two different aliases (for and from) working in the query.
This returns two columns with the values null for each column value...
Code: Select all
SELECT ua_for.user_username AS for_username, ua_from.user_username AS from_username FROM user_messages AS um LEFT JOIN user_accounts AS ua_for ON (um.id_for = ua_for.user_username) LEFT JOIN user_accounts AS ua_from ON (um.id_from = ua_from.user_username) WHERE um.id = '1'I've done some variations of MySQL queries already though I don't recall joining the same table twice for different rows. Thoughts please?