1055 MySQL Origin: Data OSI layer 7 · Application Last updated 2 Dec 2026

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column — incompatible with sql_mode=only_full_group_by

MySQL rejects a GROUP BY query that selects columns that are neither grouped nor aggregated, because the result for them would be ambiguous.

Exact message you may see is not in GROUP BY clause and contains nonaggregated columnincompatible with sql_mode=only_full_group_by
Seen on: MySQL

Meaning

Since MySQL 5.7 the ONLY_FULL_GROUP_BY mode is on by default. Older queries that relied on MySQL picking an arbitrary row per group now fail, typically after an upgrade or when moving to a new server.

Common causes

  • Selected column not in GROUP BY and not aggregated
  • Upgrade to MySQL 5.7/8 with the default sql_mode
  • ORDER BY or HAVING using a non-grouped column
  • ORM generated query without grouping all columns

⚡ Quick fix

  1. Add the column to GROUP BY or wrap it in MAX()/ANY_VALUE()
  2. Fix the query logic so each group has one defined value
  3. As a temporary workaround remove ONLY_FULL_GROUP_BY from sql_mode

Detailed fix by platform

MySQL

  1. SET SESSION sql_mode = (SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); (temporary; fix the query instead)

How to diagnose

  1. Columns — Which ones are neither grouped nor aggregated?
  2. Mode — SELECT @@sql_mode?
  3. Source — Upgrade or ORM?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1005 — MySQL ERROR 1005 (HY000): Can't create table (errno: 150 "Foreign key constraint is incorrectly formed") (MySQL)10051007 — MySQL ERROR 1007 (HY000): Can't create database 'x'; database exists (MySQL)10071054 — MySQL ERROR 1054 (42S22): Unknown column in 'field list' (MySQL)10541064 — MySQL ERROR 1064 (42000): You have an error in your SQL syntax (MySQL)10641241 — MySQL ERROR 1241 (21000): Operand should contain 1 column(s) (MySQL)12418120 — SQL Server Msg 8120: Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause (SQL)8120ORA-00979 — ORA-00979: not a GROUP BY expression (SQL)ORA-009791055

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.