1109
MySQLERRORCommonDMLHIGH confidence

Unknown table in MULTI DELETE

Production Risk

Low — DELETE is rejected; no rows are deleted.

What this means

ER_UNKNOWN_TABLE (1109, SQLSTATE 42S02) is raised in multi-table DELETE statements when the DELETE target list references a table alias or name that does not appear in the FROM/USING clause.

Why it happens
  1. 1Multi-table DELETE lists a table in the delete targets that is not in the FROM clause
  2. 2Typo in the table alias in the DELETE target list
How to reproduce
trigger — this will error
trigger — this will error
DELETE t1, t3 FROM t1 JOIN t2 ON t1.id = t2.id;
-- t3 is in the delete list but not in FROM

expected output

ERROR 1109 (42S02): Unknown table 't3' in MULTI DELETE

Fix

Ensure all DELETE targets are joined in the FROM clause

WHEN Writing multi-table DELETE.

Ensure all DELETE targets are joined in the FROM clause
DELETE t1, t2 FROM t1 JOIN t2 ON t1.id = t2.id WHERE t1.status = 'old';

Why this works

Every table listed in the DELETE target list must also appear (or be aliased) in the FROM/USING clause.

What not to do

Use multi-table DELETE without testing on a replica first

Multi-table deletes are complex and can be non-intuitive; test with SELECT before executing DELETE.

Sources
Official documentation ↗

MySQL 8.0 — 1109 ER_UNKNOWN_TABLE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors