错误时的 HQL 案例

HQL case when error

我有以下查询:

FROM Tbloans WHERE paidamt - (case when due=lastdue then dueamt else dueamt+nxtduedt end)>1

它给我这样的错误:

expecting "end", found '+' Unexpected token: end

抱歉,我的电脑无法访问互联网,所以我正在使用 phone。无法粘贴整个错误。

不要在 where 子句中使用 case。这只是布尔逻辑

WHERE (due =  lastdue and paidamt - dueamt > 1)
   OR (due <> lastdue and paidamt - (dueamt + nxtduedt) > 1)