Update SQL to fix incompatibility with sqlmode OnlyFullGroupBy #10079
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #10080
After MySQL 5.7.5 ONLY_FULL_GROUP_BY mode was added, which rejects queries which select list refer to non-aggregated columns that are neither named in the group by clause.
https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by
Describe changes proposed in this pull request:
Updated Query to utilize ANY_VALUE()
https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_any-value
MySQL vs H2 compatibility
Integration tests run agains a H2 in-memory database that does not support the
ANY_VALUE
statement. To solve this, knowledge of the database type is passed to MyBatis using the MyBatis DatabaseIdProvider mechanism that will useANY_VALUE
statements only when MySQL database is used.