Skip to content
SQL errors / Fix “Missing FROM-Clause Entry for Table” in SQL
SQL error

Fix “Missing FROM-Clause Entry for Table” in SQL

A column is prefixed with a table name or alias the FROM clause doesn't define. Use the alias you gave, or join the table.

The exact message
DuckDB
Binder Error: Referenced table "cat" not found! Candidate tables: "c"
PostgreSQL
missing FROM-clause entry for table "cat"

Using a table's name after giving it an alias is a separate message: invalid reference to FROM-clause entry for table "products", with a hint naming the alias.

SQL Server
The multi-part identifier "cat.category_name" could not be bound.

Msg 4104.

MySQL
Unknown column 'cat.category_name' in 'where clause'

Error 1054, the same error as a misspelled column.

Oracle
ORA-00904: "CAT"."CATEGORY_NAME": invalid identifier
SQLite
no such column: cat.category_name

Checked on SQLite 3.53.

The symptom

A column carries a prefix, like cat.category_name, and the database says it has no table called cat. PostgreSQL calls it a missing FROM-clause entry, SQL Server says the multi-part identifier could not be bound, and DuckDB says the referenced table was not found. The column may be fine. The part before the dot names nothing in FROM.

The prefix has to match a name the FROM clause defines: the table's alias if it has one, or its name if it doesn't. In the bench below, categories is called c, and the WHERE line asks for cat.

The fix: use the name FROM gave it

The query that fails
select p.product_name, c.category_name
from products as p
join categories as c on c.category_id = p.category_id
where cat.category_name = 'Tools'
order by p.product_name;

Running it raises Referenced table "cat" not found.

The corrected query
select p.product_name, c.category_name
from products as p
join categories as c on c.category_id = p.category_id
where c.category_name = 'Tools'
order by p.product_name;

Open the corrected query in the playground

DuckDB helps here: Candidate tables: "c" lists every name the query can use, so compare the prefix against that list.

Three other ways to get it

The table's own name after an alias. Once products is called p, the name products is gone for the rest of the query:

Wrong: the table name after an alias
select products.product_name
from products as p;
Right: the alias
select p.product_name
from products as p
limit 3;

PostgreSQL words this case differently: invalid reference to FROM-clause entry for table "products", with a hint naming the alias.

A table that was never joined. Naming a table in SELECT doesn't bring it into the query. Only FROM and JOIN do:

Wrong: customers is never joined
select o.order_id, c.first_name
from orders as o;
Right: join it first
select o.order_id, c.first_name
from orders as o
join customers as c on c.customer_id = o.customer_id
order by o.order_id
limit 3;

An alias from inside a subquery. Names given inside a subquery stay inside it. Outside, the subquery is known only by its own alias:

Wrong: o lives inside the subquery
select o.order_id
from (
  select *
  from orders as o
  where status = 'pending'
) as pending;
Right: the subquery's alias
select pending.order_id
from (
  select *
  from orders as o
  where status = 'pending'
) as pending
order by pending.order_id;

The same goes for a CTE: refer to it by the name after with, not by an alias used inside it.

Not the same as a missing column

When the prefix is right and the column after the dot is misspelled, the error is about the column instead: Referenced column not found. MySQL and SQLite use their column error for both, so check the prefix and the column name.

How other engines word it

Engine Message
DuckDB Binder Error: Referenced table "cat" not found! Candidate tables: "c"
PostgreSQL missing FROM-clause entry for table "cat" Using a table's name after giving it an alias is a separate message: invalid reference to FROM-clause entry for table "products", with a hint naming the alias.
SQL Server The multi-part identifier "cat.category_name" could not be bound. Msg 4104.
MySQL Unknown column 'cat.category_name' in 'where clause' Error 1054, the same error as a misspelled column.
Oracle ORA-00904: "CAT"."CATEGORY_NAME": invalid identifier
SQLite no such column: cat.category_name Checked on SQLite 3.53.

Related errors

Learn more