SQL ServerPostgreSQLMySQLSQLite

"The multi-part identifier could not be bound" (Msg 4104)

A column prefix — alias.column or table.column — that doesn't match anything actually in scope. The prefix itself, not the column name, is usually the broken part.

  • SQL Server: Msg 4104, Level 16, State 1 followed by The multi-part identifier "o.customer_id" could not be bound.
  • PostgreSQL: ERROR: missing FROM-clause entry for table "o"
  • MySQL: ERROR 1054 (42S22): Unknown column 'o.customer_id' in 'field list'
  • SQLite: no such column: o.customer_id

Alias o is never actually attached to a table — every engine here rejects it, including the one running live:

SQL playground
Loading editor…
⌘/Ctrl + Enter

The cause

"Multi-part identifier" just means prefix.column — and the error isn't about the column name being wrong, it's about the prefix not resolving to anything the query actually defined. o.amount fails here not because orders lacks an amount column, but because the query never introduced an alias called o — it joined orders under its own name, so orders.amount would have worked, o.amount can't.

The four shapes this takes

An alias used but never declared (the example above) — fixed by adding the alias where the table is introduced, or by dropping the prefix and using the table's real name consistently.

SQL playground
Loading editor…
⌘/Ctrl + Enter

The table name used after it was already aliased — once a table has an alias, the original table name is no longer valid as a prefix in that query, only the alias is:

SQL playground
Loading editor…
⌘/Ctrl + Enter

The subquery's own source table referenced instead of its alias — once a derived table is given an alias, that alias is the only valid prefix for its columns from outside it; the table name it was built from isn't in scope out there at all:

SQL playground
Loading editor…
⌘/Ctrl + Enter

Swap orders.order_date for recent.order_date and it works — recent is the only name that query introduced for anything inside the subquery.

INSERTED./DELETED. misused outside an OUTPUT clause (SQL-Server-specific) — these pseudo-table prefixes only exist inside a DML ... OUTPUT clause; referencing them anywhere else produces this same error because, outside that context, they're prefixes that were never introduced at all. See the OUTPUT clause.

Why the fix is always "match the prefix to what's in scope"

Every variant above reduces to the same root cause — the FROM/JOIN clause is the only place that introduces names a prefix can legally reference, and once a table has an alias there, that alias is the only valid prefix for it, not the original table name, not a prefix from a different scope. Reading the FROM clause top to bottom and matching every prefix against it catches all four cases above.

  • Ambiguous column name — the opposite problem: a prefix that resolves to more than one match instead of none.
  • JOIN syntax — where aliases get introduced in the first place.
  • OUTPUT clause — the one legal context for INSERTED./DELETED. prefixes.
Try removing the alias from the JOIN clause in the fixed example above, then query orders.amount instead of o.amount — same result, no alias needed if you're consistent about it.Open the playground →