1054ERRORTier 1 — Safe✅ HIGH confidence

Unknown column in field list

Category: SchemaVersions: All MariaDB / MySQL versions

What this means

Error 1054 (SQLSTATE 42S22) is returned when a query references a column name that does not exist in the specified table or is ambiguous in the FROM clause. This is a compile-time error — the query is rejected before execution.

Why it happens

  1. 1Column name typo in SELECT, WHERE, or ORDER BY
  2. 2Referencing a column that was renamed in a schema migration
  3. 3Using a column alias in a WHERE clause (not allowed — aliases are resolved after WHERE)
  4. 4Ambiguous column name when the same column name exists in multiple joined tables

How to reproduce

A SELECT references a column that does not exist.

trigger — this will ERROR
CREATE TABLE users (id INT, email VARCHAR(255));
SELECT user_name FROM users;  -- column is 'email', not 'user_name'
ERROR 1054 (42S22): Unknown column 'user_name' in 'field list'

Fix 1: Check the actual column names with DESCRIBE

When unsure of the exact column names.

fix
DESCRIBE users;
-- or:
SHOW COLUMNS FROM users;

Why this works

DESCRIBE returns the column name, type, nullability, key, default value, and extra attributes for each column in the table, giving the exact names to use in queries.

Fix 2: Qualify ambiguous column names with the table name

When the same column name exists in multiple joined tables.

fix
SELECT users.id, orders.id AS order_id
FROM users
JOIN orders ON users.id = orders.user_id;

Why this works

Using table.column notation eliminates ambiguity. The parser can then resolve each column reference to its specific table.

What not to do

Use SELECT * to avoid specifying column names

Why it's wrong: While SELECT * avoids 1054, it returns all columns including ones the application does not need, and will silently change shape if columns are added or removed.

Version notes

All versionsStable error code.

Sources

📚 Official docs: https://mariadb.com/kb/en/describe/

🔧 Source ref: MariaDB Server error code 1054 / ER_BAD_FIELD_ERROR

📖 Further reading: MariaDB DESCRIBE

Confidence assessment

✅ HIGH confidence

Stable.

See also

📄 Reference pages

DESCRIBESHOW COLUMNS
⚙️ 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 →