2
回答
Mybatis sql 问题!!急求!
【腾讯云】学生服务器套餐10元/月 >>>   
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select group_concat(distinct
    concat(
      'max(if(cname = ''',cname,
      ' at line 2
### The error may exist in file [E:\工具\ENV\s14\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\wtpwebapps\ssm2\WEB-INF\classes\com\cn\mapping\UsercourseMapping.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: set @sql = null;     select group_concat(distinct     concat(       'max(if(cname = ''',cname,       ''', score, 0)) as ''',       cname, ''''      )     ) into @sql    from usercourse;     set @sql = concat('select uid as 学号, uname as 姓名,sum(score) as 总分, ', @sql,                         ' from usercourse where bid=1                          group by uid ');    prepare stmt from @sql;    execute stmt;    deallocate prepare stmt;
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select group_concat(distinct
    concat(
      'max(if(cname = ''',cname,
      ' at line 2
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select group_concat(distinct
    concat(
      'max(if(cname = ''',cname,
      ' at line 2
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:963)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:842)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:827)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:91)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
<无标签>
举报
都喜
发帖于3个月前 2回/159阅
顶部