在图表帐户表
中glaccount nametext
1204005 BAH - Khay
2202013 Sales Tax Payable New
2019384 Generator
1848485 Vechicle
和其他表
此glaccount在帐户表中,此glaccount是唯一值
acdocno glaccount docamount glnametxt
0600000307 1204005 363538 BAH - Khay
0600000307 2202013 56003 Sales Tax Payable New
0600000307 1201001 456023 Accounts Receivable
0600000307 1201001 456023 Accounts Receivable
0600000307 1206004 36482 Adv Income Tax -
除了1204005以外所有的glacct固定只有1204005才会改变acdocno的变化
所以我怎么得到这个glaccount金额,即水晶报告中的363538 ..当我只拖动字段docamout然后显示456023并且我想要这个值363538
报告中的当前数据
Acdocno Total Amount Bank Amount Bank Name
0600000307 456,023.00 456,023.00 Accounts Receivable
我想要
Acdocno Total Amount Bank Amount Bank Name
0600000307 456,023.00 363538 BAH - Khay
我试过的查询
select distinct
acdocdtl.acdocno,
acdocdtl.docamount,glchaact.glnamestxt
from acdocdtl
inner join acdochdr
on
acdocdtl.acdocno =acdochdr.acdocno
and acdocdtl.cocode=acdochdr.cocode
left join glchaact
on acdocdtl.glacct = glchaact.glacct
and acdocdtl.chaact=glchaact.chaact
where acdocdtl.acdocno='0600000307'
我是怎么做到的