SQL Twit here... Can anybody help me with this? (1 Viewer)

cathie

Registered User.
Local time
Today, 04:34
Joined
Oct 21, 2017
Messages
10
I am trying to return all rows even if there are no expense entries in the ExpenseLog table. I'm pretty sure I have superfluous stuff in here. Unfortunately, I know close to nothing about SQL :( . I am getting a "'JOIN' expression not supported" error from Access 2016. I am trying to link 2 queries and a table with the commonality being LoanID (I only need to see it once). I tried adding all 3 LoanID's but that's not helping... The other 2 will always have data in them, the expense log, however, may not. Please help!

Code:
SELECT [Purchase Info per Note].LoanID, [Purchase Info per Note].PurchasePrice, Sum(ExpenseLog.NetAmount) as TotalExpenses, NoteInformationQuery.Term, NoteInformationQuery.LoanID, ExpenseLog.LoanID
FROM [Purchase Info per Note] LEFT JOIN (NoteInformationQuery LEFT JOIN ExpenseLog ON ExpenseLog.LoanID = NoteInformationQuery.LoanID) ON [Purchase Info per Note].LoanID = ExpenseLog.LoanID;
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:34
Joined
May 7, 2009
Messages
19,241
not tested yet, but you can try



SELECT [Purchase Info per Note].LoanID, [Purchase Info per Note].PurchasePrice, Sum(ExpenseLog.NetAmount) AS SumOfNetAmount, NoteInformationQuery.Term, NoteInformationQuery.LoanID, ExpenseLog.LoanID
FROM ([Purchase Info per Note] LEFT JOIN NoteInformationQuery ON [Purchase Info per Note].LoanID = NoteInformationQuery.LoanID) LEFT JOIN ExpenseLog ON [Purchase Info per Note].LoanID = ExpenseLog.LoanID
GROUP BY [Purchase Info per Note].LoanID, [Purchase Info per Note].PurchasePrice, NoteInformationQuery.Term, NoteInformationQuery.LoanID, ExpenseLog.LoanID;
 

cathie

Registered User.
Local time
Today, 04:34
Joined
Oct 21, 2017
Messages
10
That worked beautifully! Thanks so much for the assist! It is indeed greatly appreciated!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:34
Joined
May 7, 2009
Messages
19,241
you're welcome maam.
 

Users who are viewing this thread

Top Bottom