MYSql使用HQL计算子查询的总金额
以上HQL不工作。。显示以下异常 意外标记:(靠近第1行第25列)MYSql使用HQL计算子查询的总金额,mysql,spring,hibernate,Mysql,Spring,Hibernate,以上HQL不工作。。显示以下异常 意外标记:(靠近第1行第25列) HQL子查询只能出现在select或where子句中 例如,有效查询: @Query(value = "SELECT SUM(amount) FROM (SELECT t1.amount FROM Table1 t1 " + "INNER JOIN t1.table2 t2 " + "GROUP BY t1.txnId) a ") public double getAmo
HQL子查询只能出现在select或where子句中 例如,有效查询:
@Query(value = "SELECT SUM(amount) FROM (SELECT t1.amount FROM Table1 t1 "
+ "INNER JOIN t1.table2 t2 "
+ "GROUP BY t1.txnId) a ")
public double getAmount();
或
资料来源:
我建议使用本机查询代替HQL
select cat.id, (select max(kit.weight) from cat.kitten kit) from Cat as cat
select c from DomesticCat as cat
where cat.name not in (
select name.nickName from Name as name )