您好我正在使用EclipseLink并需要将以下sql查询转换为JPQL。
SELECT sum(subtotais.peso) FROM
(
SELECT SUM(t1.peso) as peso
FROM table1 t1
WHERE t1.arg1 = 1 AND t1.arg4 = 2 AND t1.arg3 = 1
UNION
SELECT SUM(cli.peso) as peso
FROM table1 t2
WHERE t2.arg1 = 1 AND t2.arg2 = 2 AND t2.arg3 = 0
) subtotais;
我试过这个
SELECT SUM(subtotais.peso) FROM
(
SELECT SUM(t1.peso) AS peso
FROM Table1 t1
WHERE t1.arg1 = 1 AND t1.arg4 = 2
AND t1.arg3 = true
UNION
SELECT SUM(cli2.peso) AS peso
FROM Table2 t2
WHERE t2.arg1 = 1 AND t2.arg2 = 2
AND t2.arg3 = false
) subtotais;
我收到了这些错误: [200,200]子表达式中缺少右括号。 [201,201]必须为范围变量声明提供标识变量。 [392,404]表达式无效,这意味着它不遵循JPQL语法。 [404,408]查询包含格式错误的结尾。