2011-02-11 72 views
3

下面的SELECT查詢工作正常:對矯正選擇查詢,刪除查詢

SELECT * FROM JBPM_JOB job WHERE job.ACTION_ IN (SELECT ID_ from JBPM_ACTION WHERE ACTIONEXPRESSION_ LIKE '%#{reminderAction.addAsyncProcessReminder%warning%'); 

然而,當我嘗試刪除此檢索的行,它失敗

DELETE FROM JBPM_JOB job WHERE job.ACTION_ IN (SELECT ID_ from JBPM_ACTION WHERE ACTIONEXPRESSION_ LIKE '%#{reminderAction.addAsyncProcessReminder%warning%'); 

這裏有什麼問題?

的錯誤信息是:

ERROR 1064 (42000): 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 'job WHERE job.ACTION_ IN (SELECT ID_ from JBPM_ACTION WHERE ACTIONEXPRESSION_ LI' at line 1

+0

什麼是錯誤信息? – StuartLC 2011-02-11 10:34:34

+0

如果遇到任何問題,請發佈錯誤消息 – 2011-02-11 10:34:40

回答

1

你需要指定你是從別名表中刪除,所以要用:

DELETE job FROM JBPM_JOB job WHERE job.ACTION_ IN (SELECT ID_ from JBPM_ACTION WHERE ACTIONEXPRESSION_ LIKE '%#{reminderAction.addAsyncProcessReminder%warning%'); 
0

我已經測試了在SQL Server查詢。工作正常,但有可能您刪除的值與PK和FK等其他表有某種關係。

如果他們有,那麼你必須刪除這些表中的記錄太...... ..........