Add any_value () package to all non-aggregated columns (that is, data directly fetched in the table)
**Note: The columns used in order by should also be wrapped**
The ANY_VALUE() function is useful when the ONLY_FULL_GROUP_BY mode is enabled and GROUP BY is used for query; this function is used to suppress the value rejection caused when the ONLY_FULL_GROUP_BY mode is enabled;
example:
SELECT
any_value ( a.id ) AS id,
a.footprint_id AS footprintId,
any_value ( a.footprint_type ) AS footprintType,
any_value ( a.user_id ) AS userId
FROM
info_footprint a
WHERE
a.footprint_type = 3
AND a.user_id = 1
AND a.del_flag = '0'
GROUP BY
footprint_id
ORDER BY
any_value(a.id) DESC
LIMIT 10;
Read More:
- [Solved] MySQL Error: “Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”
- SQL Server Group sort de duplication row_ number() over ( PARTITION BY t1.col_ 2 ORDER BY 1 )
- [Solved] MySQL Error: Can‘t find record in ‘order_form‘
- [Solved] MySQL: Syntax error or access violation: 1055 Expression #1 of SELECT list is not …
- MYSQL gruop by Error: this is incompatible with sql_mode=only_full_group_by
- [Solved] ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate
- [Solved] MYSQL 5.7 gruop by eRROR: this is incompatible with sql_mode=only_full_group_by
- [Solved] MySQL Error: ERROR 1055 (42000)sql_mode=only_full_group_by
- How to Solve MySQL version 5.7+ Group by group error
- [Solved] QuestDB Exception–ERROR: Cannot insert rows out of order.
- [Solved] MySQL Error: Client does not support authentication protocol requested by server
- [Solved] MYSQL Start Project Error: this is incompatible with sql_mode=only_full_group_by
- [MySQL] The principle of group by aggregation function and the reason for aggregation limitation SELECT list is not in GROUP BY clause and contains nonaggregated column
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- Navicat connected to Mysql error: Client does not support authentication protocol requested by server;
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used by doubl
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- [Solved] Error response from daemon: Conflict. The container name “/mysql is already in use by container
- [Solved] Sequelize DatabaseError: ER_WRONG_FIELD_WITH_GROUP: Expression #2 of SELECT list is not in GROUP
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘