What does 'ambiguous column name' mean in sql?

Example:

SELECT id FROM users u JOIN orders o ON u.id = o.id;

You've used a column name that exists in multiple tables without specifying which table it belongs to.

Solution:

Prefix the column name with the table alias or name.


SELECT u.id FROM users u JOIN orders o ON u.id = o.user_id;

Beginner's Guide to SQL