复杂删除Sql语句 Db.update()执行报错。

如:

Db.update("DELETE e FROM SL_pu_Schema.ETestSupRelateMat as e WHERE EXISTS(SELECT 1 from SL_pu_Schema.Material WHERE MaterialId=e.MaterialId AND FactoryId=1)")

评论区

JFinal

2018-09-21 17:22

根据执行时的错误提示,一步步解决就好,我这里是看不到错误的

天朝子民

2018-09-21 18:10

最起码要把错误贴出来吧

vb3g

2018-09-25 14:30

控制台没有输入详细错误信息,但报出了异常
java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'TE e FROM SL_pu_Schema.ETestSupRela',expect FROM, actual FROM FROM : DELETE e FROM SL_pu_Schema.ETestSupRelateMat as e WHERE EXISTS(SELECT 1 from SL_pu_Schema.Material WHERE MaterialId=e.MaterialId AND FactoryId=1)

小马程序猿

2018-09-27 09:52

sql 本身在数据库能执行吗

fansunion

2018-10-10 22:35

语句这么复杂,问题自然多多。

fansunion

2018-10-10 22:36

@JFinal 语句太复杂了,难以维护。

flower929

2021-04-07 11:57

sql:Db.use("np3").update(
"DELETE FROM np_media_thirdpart_user m WHERE m.enterprise_id =? AND m.user_id =? AND m.media_id IN (SELECT id FROM np_media_thirdpart WHERE enterprise_id = m.enterprise_id AND module =?)",
eid, uid, module); 我本地运行可以,但是服务器上报错,错误信息如下:com.jfinal.plugin.activerecord.ActiveRecordException: 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 'mu where mu.enterprise_id=101 and mu.user_id=372140 and mu.media_id in (select i' at line 1

热门反馈

扫码入社