Skip to content
Advertisement

Problem with Ambiguous Column Name in SQL script

I am new to SQL and using this online compiler.

https://www.programiz.com/sql/online-compiler/

I have the following script and I am getting the error: Error: ambiguous column name: Customers.customer_id

There is a customer_id column in multiple tables, but I am specifying which table to pull each column from. Why is it still saying it is ambiguous?

Advertisement

Answer

An UPDATE statement with a join requires an alias for the table being updated. In that case, the following will work as expected. You can also alias the Orders table if desired.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement