-
版本信息:源码版本:3.2.4 问题描述:出错的sql Execute SQL:SELECT COUNT(*) FROM (SELECT type, label, max(state) state, min(create_time) create_time FROM c_dictionary WHERE tenant_code = '1111' GROUP BY type) TOTAL 错误原因 [lamp-authority-server:8764:1111:1417032702296588288] 2021-07-19 16:11:20.613:[ WARN] [20560] [6e89dee752af40aca78607461840b17e] [http-nio-8764-exec-6:1390983] [c.t.b.boot.handler.AbstractGlobalExceptionHandler.otherExceptionHandler:225] Exception:
org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lamp_column.c_dictionary.label' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
### The error may exist in file [D:\project\lamp-cloud\lamp-authority\lamp-authority-biz\target\classes\mapper_authority\ext\common\DictionaryMapper.xml]
### The error may involve com.tangyh.lamp.authority.dao.common.DictionaryMapper.pageType-Inline
### The error occurred while setting parameters
### SQL: SELECT COUNT(*) FROM (SELECT type, label, max(state) state, min(create_time) create_time FROM c_dictionary WHERE tenant_code = '1111' GROUP BY type) TOTAL
### Cause: java.sql.SQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lamp_column.c_dictionary.label' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lamp_column.c_dictionary.label' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy166.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForIPage(MybatisMapperMethod.java:121)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:85)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
at com.sun.proxy.$Proxy205.pageType(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy206.pageType(Unknown Source)
at com.tangyh.lamp.authority.service.common.impl.DictionaryServiceImpl.pageType(DictionaryServiceImpl.java:114) |
Beta Was this translation helpful? Give feedback.
Answered by
xia5800
Jul 19, 2021
Replies: 1 comment
-
已解决,是MySql5.7的配置only_full_group_by的问题。在mysql配置文件中,关闭掉就好了 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
xia5800
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
已解决,是MySql5.7的配置only_full_group_by的问题。在mysql配置文件中,关闭掉就好了