optimize tenant with saldo query

This commit is contained in:
2021-09-14 14:14:56 +02:00
parent 797cbb4b65
commit 76255efbe9
9 changed files with 138 additions and 9 deletions

View File

@ -31,4 +31,16 @@ def get_account_saldo(user, token_info, accountId=None):
"statement": "SELECT sum(amount) as saldo FROM account_entry_t WHERE account=%s",
"params": (accountId, )
}
)
)
def get_tenant_with_saldo(user, token_info):
return dbGetMany(user, token_info, {
"statement": """
SELECT t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo
FROM tenant_t t, account_entry_t a
WHERE a.account = t.account
GROUP BY t.firstname, t.lastname, t.address1
""",
"params": ()
}
)