Skip to content

Missing FROM Clause Entry

Error message

                missing FROM-clause entry for table
              

Quick summary

You used a column from a table that is not listed in the FROM clause or JOIN — the database does not know where to get it.

Why this happens

  • Referencing a table in SELECT or WHERE without including it in FROM/JOIN

  • Forgetting to add a JOIN when referencing a related table's columns

  • Typo in a table alias

Minimal example

✗ Broken code
SELECT orders.id, users.name
FROM orders
-- users table is not in the FROM clause or a JOIN
✓ Fixed code
SELECT orders.id, users.name
FROM orders
INNER JOIN users ON orders.user_id = users.id;

The users table was referenced but not joined. Adding the JOIN makes the column available.

How to diagnose

  • Check all tables referenced in the SELECT and WHERE clauses

  • Verify each referenced table is in the FROM clause or a JOIN

  • Check table aliases for typos

How to fix

  • Add the missing table to the FROM clause or add a JOIN

  • Fix the table alias to match the one defined in FROM/JOIN

  • Remove the column reference if it is not needed

How to prevent

  • Review queries to ensure all referenced tables are in FROM/JOIN

  • Use a query builder or ORM that validates table references

  • Test queries in a SQL client before deploying

Related Resources

Related Glossary

Related Lessons

  • Joins

    Learn how to properly join tables.

← Back to language