4101
MariaDBWARNINGCriticalHIGH confidence

ASC/DESC in GROUP BY is deprecated

Production Risk

Low — The query still executes, but behavior may change in future versions.

Why it happens
  1. 1A query uses GROUP BY col ASC or GROUP BY col DESC.

Fix

Replace GROUP BY ordering with ORDER BY

Replace GROUP BY ordering with ORDER BY
SELECT col, COUNT(*) FROM t GROUP BY col ORDER BY col ASC;

Why this works

Moves the ordering intent to ORDER BY, which is standards-compliant and supported in all MySQL versions.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 4101 ER_WARN_DEPRECATED_GROUP_BY_ASC_DESC_IN_BLOCK

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

← All MariaDB errors