以下查询需要帮助。谢谢
SELECT b.SchemeCode_Db,
'DBELE',
1,
SecurityCode_Db,
"DIRECT",
Qty,
Price,
((Commission + TransferCharge) / Qty) AS Charges,
"",
iif(Buy_sell_code = "1110",
((Qty * Price) + Commission + TransferCharge),
iif(Buy_sell_code = "1120", ((Qty * Price) - Commission
- TransferCharge
))) AS totalCost,
BrokerCode_Db,
"",
Deal,
Format(Tradedate, "dd/MM/yyyy"),
Format(Valuedate, "dd/MM/yyyy"),
'', 'BSE', 'CH', 'D', '',
iif(Buy_sell_code = "1110",
'PUR',
iif(Buy_sell_code = "1120", 'SAL')) AS txn,
'USD' AS cur
FROM tbl_EQUITYINPUT a
LEFT JOIN tbl_EQUITYMapping b
ON FundCode = SchemeCode_Client
LEFT JOIN tbl_EQUITYMapping c
ON Ticker = SecurityCode_Client
LEFT JOIN tbl_EQUITYMapping d
ON Broker = Brokercode_Client