如何在sql中對來自其他表的字段進行分組。這裏是我的代碼SQL Group按字段從其他表
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