Skip to content
SQL errors / “Referenced Column Not Found” — Fix This SQL Error
SQL error

“Referenced Column Not Found” — Fix This SQL Error

No table in the FROM clause has a column by that name. Usually a typo or a table you did not join.

The exact message
DuckDB
Binder Error: Referenced column "prodct_price" not found in FROM clause!
PostgreSQL
column "prodct_price" does not exist
MySQL
Unknown column 'prodct_price' in 'field list'

Error 1054.

SQL Server
Invalid column name 'prodct_price'.
Oracle
ORA-00904: "PRODCT_PRICE": invalid identifier
SQLite
no such column: prodct_price

The symptom

The query names a column and the database answers Referenced column "prodct_price" not found in FROM clause. The statement parsed correctly, so the shape of the SQL is fine. The problem is that the name does not resolve to anything the query can see.

Why it happens

A column reference is resolved against the tables in the FROM clause, and nothing else. Three causes cover almost every case:

  • The name is misspelled, as in the bench below.
  • The column exists, but on a table you did not join, so it is not in scope.
  • The column was renamed by an alias earlier in the query, and the old name no longer exists at this point.

The message names the column it could not resolve. Compare that string against the table's real column list before assuming the table is wrong.

The fix

Correct the spelling to price. If the name looks right, list the columns the table actually has and compare, using describe products in DuckDB or the equivalent in your engine; SHOW TABLES and DESCRIBE lists the command for each database.

When the column belongs to another table, add the join that brings it into scope, then qualify the reference with the table alias so it is unambiguous.

The query that fails
select product_name, prodct_price
from products
order by prodct_price desc

Running it raises not found in FROM clause.

The corrected query
select product_name, price
from products
order by price desc

Open the corrected query in the playground

Watch out

A column referenced in ORDER BY is resolved after the SELECT list, so an output alias works there. The same alias in WHERE is not portable. See filtering on a SELECT alias.

How other engines word it

Engine Message
DuckDB Binder Error: Referenced column "prodct_price" not found in FROM clause!
PostgreSQL column "prodct_price" does not exist
MySQL Unknown column 'prodct_price' in 'field list' Error 1054.
SQL Server Invalid column name 'prodct_price'.
Oracle ORA-00904: "PRODCT_PRICE": invalid identifier
SQLite no such column: prodct_price

Related errors

Learn more