In DB, i have ‘(Number of) ID’ column and ‘Date’ column having date format as DD:MM:YYYYTHH:MM:SS.
For e.g.
ID Date 5 12.07.2020T11:11:43
7 11.06.2020T15:14:45
8 12.07.2020T11:14:45
6 11.06.2020T14:14:45
Using JPA (with Spring boot in Java), I want to calculate SUM of particular items for single day.(e.g. sum of items for single day for 12:07:2020 ( 5 + 8) and for 11.06.2020 (7 + 6). Can i do SUM opeartion for single day in this case ?
Regards, Stephan
You can do that, by using a native query:
@Query(value = "SELECT sum(Id),Date FROM IdDateS WHERE u.date = ?1 GROUP BY Date", nativeQuery = true) Collection<IdDate> findSumOfIdOnSpecificDay(Timestamp date);