I will simplify my scenario - I have these two tables:
table_A - id int, id_table_B_one int, id_table_B_two int, name varchar(30)
table_B - id int, name varchar(30), description varchar(30)
Then I have this query:
SELECT
table_A.id, table_A.name, table_B_one.*, table_B_two.*
FROM
table_A
LEFT JOIN table_B table_B_one ON table_A.id_table_B_one = table_B.id
LEFT JOIN table_B table_B_two ON table_A.id_table_B_two = table_B.id
My problem is that I will get 3 columns with the same names (id and name). I know that I can use the keyword "AS" to indicate a single column alias. However, I will need to specify each selected column, but I have to use the wildcard character '*'.
Is there any way how to set the alias column name using the '*' template? Something like that:
... table_B_one. * AS table_B_one_ * ...
source
share