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: ERROR 1055 (42000)sql_mode=only_full_group_by
- [Solved] MySQL Error: “Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”
- MYSQL gruop by Error: this is incompatible with sql_mode=only_full_group_by
- [Solved] MySQL: Syntax error or access violation: 1055 Expression #1 of SELECT list is not …
- Tkmybatis uses Example.SetOrderByClause Use for sorting and multiple sort fields
- [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
- How to Solve MySQL version 5.7+ Group by group error
- [Solved] Sequelize DatabaseError: ER_WRONG_FIELD_WITH_GROUP: Expression #2 of SELECT list is not in GROUP
- [Solved] ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate
- [Solved] hive sql Error: ParseException in subquery source
- How to Solve mysql [Err] 1067-Invalid default value for
- Mysql :error 1111. Invalid use of group function
- [Solved] MYSQL 5.7 gruop by eRROR: this is incompatible with sql_mode=only_full_group_by
- [Solved] PostgreSQL enumeration type usage error: operator does not exist error handling
- MYSQL Create TIMESTAMP and Save Error: ERROR 1067 (42000): Invalid default value for ‘last_updated_on’
- [Solved] SQL Error: Method queryTotal execution error of sql
- [Solved] MySQL5.6.44 [Err] 1067 – Invalid default value for create_date settlement programme
- Introduction to Relational Databases in SQL
- postgresql-Database query problem-ERROR: column “t.domainid“ must appear in the GROUP BY clause or be used in an a
- SQL Server Group sort de duplication row_ number() over ( PARTITION BY t1.col_ 2 ORDER BY 1 )