select
a.order_line,
a.product_id,
a.sales,
b.customer_name,
b.age
from sales_2015 as a
inner join customer_20_60 as b
on a.customer_id = b.customer_id
order by customer_id;
I got an error message: column reference "customer_id is ambiguous. How do I solve this problem?
CodePudding user response:
Just means that multiple tables have same column name and it doesn't know which to use.
In your case, both - sales_2015
and customer_20_60
tables have the column customer_id.
Make sure you use the a.customer_id
or b.customer_id
in all the places. Based on the code you have pasted, looks like the only place this is missing is in the order by clause.