gpt4 book ai didi

mysql - Spring data jpa sum 与 group by

转载 作者:行者123 更新时间:2023-11-29 07:22:04 25 4
gpt4 key购买 nike

我正在尝试运行这个简单的查询,但没有成功。有人可以帮我解决这个问题吗?

谢谢

@Query(nativeQuery = true, value = "select kategorie, sum(amount) amount from Transaction where date between ?1 and ?2 group by kategorie")
List<Transaction> countCashPaymentInMonth(Date from, Date to);

在 mysql 中查询工作正常。

我正在接收

ERROR o.h.e.jdbc.spi.SqlExceptionHelper - Column "id" was not find

我正在使用

spring-boot-starter-data-jpa
1.3.3.RELEASE

最佳答案

应该是

List<Object[]> countCashPaymentInMonth(Date from, Date to);

关于mysql - Spring data jpa sum 与 group by,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35786020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com