如何在 sql 中对其他表中的字段进行分组。这是我的代码
select
sum(a.trans_amount), (
select
ledger_name
from
ledger_master
where
ledger_master.ledger_code = transaction_ledger.ledger_code
) as ledger_name,
ledger_code
from
transaction_ledger
where
ledger_parent = 'Sundry Debtors'
group by
ledger_code,
ledger_name