user802293
user802293

Reputation: 173

Spring data jpa sum with group by

I am trying to run this simple query but without success. Can someone help me with this?

Thank you

@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);

In mysql is query working fine.

I am receiving

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

I am using

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

Upvotes: 1

Views: 4193

Answers (1)

user802293
user802293

Reputation: 173

Should be

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

Upvotes: 3

Related Questions