You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select sj.*, (select stuff( (select','+su_.real_namefrom t_system_user su_ inner join t_user_job uj_ onuj_.user_id=su_.idwhereuj_.job_id=sj.idorder bysu_.real_name for xml path('')), 1, 1, '')) as user_names from t_system_job sj where1=1order bysj.job_indexasc, sj.iddesc
期望的结果:
selectcount(0) from ( select sj.*, (select stuff( (select','+su_.real_namefrom t_system_user su_ inner join t_user_job uj_ onuj_.user_id=su_.idwhereuj_.job_id=sj.idorder bysu_.real_name for xml path('')), 1, 1, '')) as user_names from t_system_job sj where1=1 ) tmp_count
完整异常信息
org.springframework.jdbc.UncategorizedSQLException:
### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。
### The error may exist in file [\mapper\SystemJobMapper.xml]
### The error may involve mapper.SystemJobMapper.queryJobsByCondition-Inline
### The error occurred while setting parameters
### SQL: select count(0) from ( select sj.*, (select stuff( (select ',' + su_.real_name from t_system_user su_ inner join t_user_job uj_ on uj_.user_id = su_.id where uj_.job_id = sj.id order by su_.real_name for xml path('')), 1, 1, '')) as user_names from t_system_job sj where 1 = 1 order by sj.job_index asc, sj.id desc ) tmp_count
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。
; uncategorized SQLException; SQL state [S0001]; error code [1033]; 除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: 除非另外还指定了 TOP、OFFSET 或 FOR XML,否则,ORDER BY 子句在视图、内联函数、派生表、子查询和公用表表达式中无效。
异常模板
使用环境
SQL 解析错误
分页参数
原 SQL
期望的结果:
完整异常信息
其他类型的错误
跟踪发现在引用
jsqlparser4.7
时,DefaultCountSqlParser.getSmartCountSql()
方法中stmt = SqlParserUtil.parse(sql);
语句执行报异常且结果为null,进而导致走这一句return this.getSimpleCountSql(sql, countColumn);
,之后保留了order by子句导致SQLServer查询异常。jsqlparser4.7
解析上述原SQL语句的异常信息如下:最后切换回
jsqlparser4.5
才正常,jsqlparser的各种版本真的是太坑人了,吓得都不敢升级了。功能建议
详细说明,尽可能提供(伪)代码示例。
The text was updated successfully, but these errors were encountered: