Column reference is ambiguous / Column 'id' in field list is ambiguous (MySQL 1052)
A column name exists in more than one joined table, so the database doesn’t know which one you mean.
is ambiguouscolumn reference is ambiguousambiguous column nameIntegrity constraint violation: 1052 Meaning
After a JOIN, unqualified names like id, name or created_at usually exist in several tables. Qualify them with the table name or alias.
Common causes
- Unqualified column in SELECT/WHERE/ORDER BY after a JOIN
- Same column name in a subquery and outer query
- ORM building raw where clauses without table prefixes
⚡ Quick fix
- Prefix columns with table aliases (
u.id,o.id) - Alias output columns that share names (
o.id AS order_id)
Detailed fix by platform
SQL
- Qualify every column in joins:sql
SELECT u.id AS user_id, o.id AS order_id, o.total FROM users u JOIN orders o ON o.user_id = u.id WHERE o.status = 'paid' ORDER BY o.created_at DESC;
PHP
- Laravel:
->where('orders.status', 'paid')instead of->where('status', 'paid')on joined queries.
How to diagnose
- Column — Which column is named?
- Tables — Which joined tables contain it?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026