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.
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026