我正在设置一个MSquery,以将一些数据从Access数据库提取到Excel工作表中。我需要一个左外部联接,所有其他联接都是内部联接。
我尝试在外部编写SQL并在MSquery中运行,但是我总是得到“无法添加表名”。
SELECT SplitParent_IDT.SplitParentID, ComprehensiveTransactionDetailT_1.AttNum, ComprehensiveTransactionDetailT_1.TransactionDate, ComprehensiveTransactionDetailT_1.TransactionDetailName, TranSubDetailT_1.EventName, TranSubDetailT_1.TransactionType, Sum(ComprehensiveTransactionDetailT.NetAmount) as 'NetAmt'
From
(`R:\Database Info\Database\Propay\Access\Propay.accdb`.ComprehensiveTransactionDetailT ComprehensiveTransactionDetailT_1
Left Outer Join
`R:\Database Info\Database\Propay\Access\Propay.accdb`.TranSubDetailT TranSubDetailT_1
ON
TranSubDetailT_1.Comment2 = ComprehensiveTransactionDetailT_1.Comment2)
Inner Join
`R:\Database Info\Database\Propay\Access\Propay.accdb`.SplitParent_IDT SplitParent_IDT
ON
ComprehensiveTransactionDetailT_1.TransactionInfoId = SplitParent_IDT.SplitParentID
Inner Join
`R:\Database Info\Database\Propay\Access\Propay.accdb`.ComprehensiveTransactionDetailT ComprehensiveTransactionDetailT
ON
SplitParent_IDT.TransactionInfoId = ComprehensiveTransactionDetailT.TransactionInfoId
Inner Join
`R:\Database Info\Database\Propay\Access\Propay.accdb`.TranDespT TranDespT
ON
ComprehensiveTransactionDetailT.TransDescription = TranDespT.TransDescription
WHERE ((ComprehensiveTransactionDetailT.AccountNum=32550004) AND (TranDespT.TranGroup<>'DNP'))
GROUP BY SplitParent_IDT.SplitParentID, ComprehensiveTransactionDetailT_1.AttNum, ComprehensiveTransactionDetailT_1.TransactionDate, ComprehensiveTransactionDetailT_1.TransactionDetailName, TranSubDetailT_1.EventName, TranSubDetailT_1.TransactionType