MySQL 8.4Lab-verified · 2026-11-29

MySQL ERROR 1052 (23000): Column 'id' in field list is ambiguous

In a JOIN, a column name exists in more than one table and the query does not say which one.

MySQL 8.4.13
1052 (23000): Column 'id' in field list is ambiguous

Jump to a cause

  1. 01SELECT id with a JOIN where both tables have id
  2. 02WHERE status = ... when both tables have status
  3. 03ORDER BY created_at when both tables have created_at

Lab-verifiedReproduced and fixed on MySQL 8.4.13 · 2026-11-29 · container image mysql:8.4

When two joined tables both have a column with the same name — id, status, name, created_at — MySQL cannot tell which one you mean and stops with ERROR 1052. The message names the column and where it was used: field list (SELECT), where clause, or order clause.

This tends to appear after a working single-table query gets a JOIN added. The three runs below hit it in SELECT, WHERE and ORDER BY, and all were fixed by writing the table alias in front of the column, such as o.id.

01SELECT id with a JOIN where both tables have id

SELECT id, name, amount FROM orders JOIN customers ON ... failed with Column 'id' in field list is ambiguous.

information_schema.columns showed id in both customers and orders. With aliases — SELECT o.id AS order_id, c.name, o.amount FROM orders o JOIN customers c ... — it returned orders 10 (Kim) and 11 (Lee).

Setup
Setuprun as lab_a
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50));
CREATE TABLE orders (id INT PRIMARY KEY, customer_id INT, amount DECIMAL(10,2));
INSERT INTO customers VALUES (1, 'Kim'), (2, 'Lee');
INSERT INTO orders VALUES (10, 1, 100.00), (11, 2, 70.00);
OUTPUT
Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0
Reproducerun as lab_a
SELECT id, name, amount FROM orders JOIN customers ON orders.customer_id = customers.id;
✕ ERROR
ERROR 1052 (23000): Column 'id' in field list is ambiguous
Checkrun as lab_a
SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = 'lab_a' AND column_name = 'id' ORDER BY table_name;
OUTPUT
+------------+-------------+
| TABLE_NAME | COLUMN_NAME |
+------------+-------------+
| customers  | id          |
| orders     | id          |
+------------+-------------+
2 rows in set (0.00 sec)
After the fixrun as lab_a
SELECT o.id AS order_id, c.name, o.amount FROM orders o JOIN customers c ON o.customer_id = c.id ORDER BY o.id;
✓ SUCCESS
+----------+------+--------+
| order_id | name | amount |
+----------+------+--------+
|       10 | Kim  | 100.00 |
|       11 | Lee  |  70.00 |
+----------+------+--------+
2 rows in set (0.00 sec)

02WHERE status = ... when both tables have status

customers and orders both had a status column. ... WHERE status = 'paid' failed with Column 'status' in where clause is ambiguous.

Writing WHERE o.status = 'paid' returned orders 10 and 11 and left out the canceled order 12.

Setup
Setuprun as lab_a
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50), status VARCHAR(10));
CREATE TABLE orders (id INT PRIMARY KEY, customer_id INT, status VARCHAR(10));
INSERT INTO customers VALUES (1, 'Kim', 'active'), (2, 'Lee', 'closed');
INSERT INTO orders VALUES (10, 1, 'paid'), (11, 2, 'paid'), (12, 1, 'canceled');
OUTPUT
Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.02 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0
Reproducerun as lab_a
SELECT o.id, c.name FROM orders o JOIN customers c ON o.customer_id = c.id WHERE status = 'paid';
✕ ERROR
ERROR 1052 (23000): Column 'status' in where clause is ambiguous
Checkrun as lab_a
SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = 'lab_a' AND column_name = 'status' ORDER BY table_name;
OUTPUT
+------------+-------------+
| TABLE_NAME | COLUMN_NAME |
+------------+-------------+
| customers  | status      |
| orders     | status      |
+------------+-------------+
2 rows in set (0.00 sec)
After the fixrun as lab_a
SELECT o.id, c.name FROM orders o JOIN customers c ON o.customer_id = c.id WHERE o.status = 'paid' ORDER BY o.id;
✓ SUCCESS
+----+------+
| id | name |
+----+------+
| 10 | Kim  |
| 11 | Lee  |
+----+------+
2 rows in set (0.00 sec)

03ORDER BY created_at when both tables have created_at

Both employees and departments had created_at. ORDER BY created_at failed with Column 'created_at' in order clause is ambiguous, even though the SELECT list itself used aliases.

ORDER BY e.created_at sorted by the employee's date: Choi (2023-05-01), then Park (2024-03-01).

Setup
Setuprun as lab_a
CREATE TABLE departments (id INT PRIMARY KEY, name VARCHAR(50), created_at DATE);
CREATE TABLE employees (id INT PRIMARY KEY, dept_id INT, name VARCHAR(50), created_at DATE);
INSERT INTO departments VALUES (1, 'Sales', '2020-01-01'), (2, 'IT', '2021-01-01');
INSERT INTO employees VALUES (100, 1, 'Park', '2024-03-01'), (101, 2, 'Choi', '2023-05-01');
OUTPUT
Query OK, 0 rows affected (0.02 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0
Reproducerun as lab_a
SELECT e.name AS employee, d.name AS department FROM employees e JOIN departments d ON e.dept_id = d.id ORDER BY created_at;
✕ ERROR
ERROR 1052 (23000): Column 'created_at' in order clause is ambiguous
Checkrun as lab_a
SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = 'lab_a' AND column_name = 'created_at' ORDER BY table_name;
OUTPUT
+-------------+-------------+
| TABLE_NAME  | COLUMN_NAME |
+-------------+-------------+
| departments | created_at  |
| employees   | created_at  |
+-------------+-------------+
2 rows in set (0.00 sec)
After the fixrun as lab_a
SELECT e.name AS employee, d.name AS department, e.created_at FROM employees e JOIN departments d ON e.dept_id = d.id ORDER BY e.created_at;
✓ SUCCESS
+----------+------------+------------+
| employee | department | created_at |
+----------+------------+------------+
| Choi     | IT         | 2023-05-01 |
| Park     | Sales      | 2024-03-01 |
+----------+------------+------------+
2 rows in set (0.00 sec)

FAQ

How do I fix Column 'id' in field list is ambiguous?

Put the table name or alias in front of the column: o.id instead of id. Do it wherever that column appears in the query.

What do field list, where clause and order clause mean in the message?

Where the ambiguous column was used: field list is the SELECT list, where clause is WHERE, order clause is ORDER BY.

The query worked before I added a JOIN. Why?

With one table every column name is unique. The joined table brought a column with the same name, so the unqualified name became ambiguous.

Is this the same as ORA-00918 in Oracle?

It is the same mistake. Oracle reports it as ORA-00918 (column ambiguously specified).

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test, each with full rights on a database of the same name (its default database); root is the administrator. MySQL 8.4.13