3653
MySQLERRORNotableQueryHIGH confidence

Column count mismatch in SELECT (variant 2)

Production Risk

Medium — Query fails; application may receive unexpected errors.

How to reproduce
trigger — this will error
trigger — this will error
SELECT a, b FROM t1 UNION SELECT c FROM t2;

expected output

ERROR 3653 (HY000): The used SELECT statements have a different number of columns.

Fix

Match column counts in UNION

Match column counts in UNION
SELECT a, b FROM t1 UNION SELECT c, d FROM t2;

Why this works

Ensures both UNION operands have the same number of columns.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 3653 ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT2

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

← All MySQL errors