Fix transaction sum query
This commit is contained in:
parent
017cec7d3d
commit
f5c6857d71
1 changed files with 1 additions and 1 deletions
|
@ -13,7 +13,7 @@ interface TransactionRepository: PagingAndSortingRepository<Transaction, Long> {
|
||||||
fun findAllByAccountAndCategory(account: Account, category: Category): List<Transaction>
|
fun findAllByAccountAndCategory(account: Account, category: Category): List<Transaction>
|
||||||
@Query(
|
@Query(
|
||||||
nativeQuery = true,
|
nativeQuery = true,
|
||||||
value = "SELECT (COALESCE((SELECT SUM(amount) from transaction WHERE is_expense = 0), 0)) - (COALESCE((SELECT SUM(amount) from transaction WHERE is_expense = 1), 0));"
|
value = "SELECT (COALESCE((SELECT SUM(amount) from transaction WHERE expense = 0), 0)) - (COALESCE((SELECT SUM(amount) from transaction WHERE expense = 1), 0));"
|
||||||
)
|
)
|
||||||
fun sumBalanceByAccount(account: Account): Long
|
fun sumBalanceByAccount(account: Account): Long
|
||||||
}
|
}
|
Loading…
Reference in a new issue