I have 2 tables Customer
and Customer_address
connected by a customer_code
column.
I need to create a select query to bring all columns from both tables. The problem is that I need to use aliases for the duplicated columns.
I tried:
select * from Customer left join Customer_address on Customer.customer_code=Customer_address.customer_code
Not working as expected. How can I avoid the duplicated without having to type all columns ?
If the only duplicate column name is the one used for the JOIN
, you can use the USING
clause:
select *
from Customer c left join
Customer_address ca
using (customer_code);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With