Assign allias on 2 left joins

Hello Forums,

I have this table

user
id first type
1 jane A
2 john B

order_table
id a_id b_id
1 1 2

I left joined order_table.a_id to user.id and order_table.b_id to user.id

SELECT first FROM user
LEFT JOIN user ON order_table.a_id = user.id AND order_table.b_id = user.id
WHERE order_table.id = 1

I need to create an alias for “first” to differentiate between types.
Any ideas?

Thanks


select A.first,
       B.first
  from user A
  join order_table
    on A.id = order_table.a_id
  join user B
    on order_table.b_id = B.id
 where order_table.id = 1


select A.first [COLOR=#ff0000]a_first[/COLOR], 
       B.first [COLOR=#ff0000]b_first[/COLOR]
  from user A
  join order_table
    on A.id = order_table.a_id
  join user B
    on order_table.b_id = B.id
 where order_table.id = 1

sequence of tables in the FROM clause needs to be discombobulated

SELECT a.first AS a_first
     , b.first AS b_first
  FROM order_table
INNER
  JOIN user AS a
    ON a.id = order_table.a_id
INNER
  JOIN user AS b
    ON b.id = order_table.b_id
 WHERE order_table.id = 1

FTFY :smiley: