我有以下HQL查詢:休眠,MySQL的
UPDATE TaskAssessment taskAssessment
SET taskAssessment.activeFlag = false
WHERE taskAssessment IN
(
SELECT taskAssessment2
FROM TaskAssessment taskAssessment2
Where taskAssessment2.activeFlag = true
AND taskAssessment2.patient.id
AND taskAssessment2.needsLevel.careNeed = :careNeed
)
但它給我的錯誤:
You can't specify target table 'TASK_ASSESSMENT' for update in FROM clause
任何人都可以幫我糾正MySQL的查詢和休眠。提前致謝。
見http://stackoverflow.com/questions/45494/sql- delete-cant-specify-target-table-for-update-in-from-clause – axtavt 2011-02-28 17:25:51
我看到了,但是當我試着說出乎意料的時候(在查詢中! – Ikthiander 2011-02-28 17:27:25
@ user582862:你能發表你已經試過的東西嗎? – 2011-02-28 17:35:38