1052ERRORTier 1 — Safe✅ HIGH confidence

Column in field list is ambiguous

Category: Query SyntaxVersions: All MariaDB / MySQL versions

What this means

Error 1052 (SQLSTATE 23000) is raised when a column name referenced in a SELECT, WHERE, or ORDER BY clause exists in more than one table involved in a JOIN and is not qualified with a table alias or table name.

Why it happens

  1. 1Two or more joined tables share a column name (e.g. both have an id or name column)
  2. 2Column reference is unqualified — no table prefix or alias

How to reproduce

A SELECT with a JOIN where the column name appears in multiple tables.

trigger — this will ERROR
SELECT id, name
FROM orders
JOIN customers ON orders.customer_id = customers.id;
-- 'id' and 'name' exist in both tables
ERROR 1052 (23000): Column 'id' in field list is ambiguous

Fix 1: Qualify every ambiguous column with a table alias

Always — qualify columns in multi-table queries.

fix
SELECT o.id AS order_id, c.id AS customer_id, c.name
FROM orders o
JOIN customers c ON o.customer_id = c.id;

Why this works

Prefixing columns with a table alias removes ambiguity. Assigning aliases to result columns also prevents confusion in application code.

What not to do

Use SELECT * in multi-table JOINs

Why it's wrong: Returns duplicate column names and masks ambiguity errors until they surface as bugs.

Sources

📚 Official docs: https://mariadb.com/kb/en/join-syntax/

🔧 Source ref: MariaDB Server error code 1052 / ER_NON_UNIQ_ERROR

📖 Further reading: MariaDB JOIN Syntax

Confidence assessment

✅ HIGH confidence

Stable.

See also

📄 Reference pages

JOIN syntaxtable alias
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →