我正在尝试将本机查询转换为JPQL,但是select的UPDATE存在问题。
UPDATE DocumentBody PP SET PP.prepaidLeft = PP.prepaidLeft + (SELECT R.amount
FROM ReferencePrepaymentDocument R WHERE PP.documentBodyId =
R.prepaymentDocumentBodyId AND R.documentHeaderId=:NaglDokRozchID) WHERE EXISTS
(SELECT R.amount FROM ReferencePrepaymentDocument R WHERE PP.documentBodyId =
R.prepaymentDocumentBodyId AND R.documentHeaderId=:NaglDokRozchID)
我这样尝试过JOIN:
UPDATE DocumentBody PP SET PP.prepaidLeft = PP.prepaidLeft + amount JOIN
(select R.amount from ReferencePrepaymentDocument R where PP.documentBodyId =
R.prepaymentDocumentBodyId and R.documentHeaderId=:NaglDokRozchID) amount ON
PP.documentBodyId = R.prepaymentDocumentBodyId where exists (select R.amount
from ReferencePrepaymentDocument R where PP.documentBodyId =
R.prepaymentDocumentBodyId and R.documentHeaderId=:NaglDokRozchID)
但是我得到“运算符或期望的位置,得到'JOIN'“。
谢谢。