fix(billing): add acc_date to aggregate query for sqlor ORDER BY
sqlor wraps every sqlExe with row_number() over(order by acc_date desc). Aggregate queries without acc_date in SELECT fail with: Unknown column 'acc_date' in 'ORDER BY' Fix: add min(acc_date) as acc_date to satisfy sqlor wrapper.
This commit is contained in:
parent
fba38804de
commit
1ffdda5ffe
@ -32,7 +32,8 @@ where a.orgid = ${orgid}$
|
||||
stats_sql = """select
|
||||
count(*) as total_count,
|
||||
coalesce(sum(case when d.acc_dir = '1' then d.amount else 0 end), 0) as debit_sum,
|
||||
coalesce(sum(case when d.acc_dir = '0' then d.amount else 0 end), 0) as credit_sum
|
||||
coalesce(sum(case when d.acc_dir = '0' then d.amount else 0 end), 0) as credit_sum,
|
||||
min(d.acc_date) as acc_date
|
||||
from acc_detail d
|
||||
join account a on d.accountid = a.id COLLATE utf8mb4_unicode_ci
|
||||
where a.orgid = ${orgid}$
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user