Problem with query

noccy

Registered User.
Local time
Today, 04:21
Joined
Aug 19, 2003
Messages
67
Problem with query and two forregin keys

Hello!

I have the folowing tables:

TblTransactions[Date, Time, SenderAccount, ReceiverAccount]
TblAccounts[Account, Owner]

How can I make a query like this: [Date, Time, SenderAccount, OwnerSenderAccount, ReceiverAccount, OwnerReceiverAccount]?

I want to do a lookup from both SenderAccount and ReceiverAccount, and find the owners...

noccy
 
Last edited:
Assuming SenderAccount and ReceiverAccount both tie to Account...

SELECT TT.Date, TT.Time, TT.SenderAccount, TAS.Owner as OwnerSenderAccount, TT.ReceiverAccount, TAR.Owner as OwnerReceiverAccount
FROM TblTransactions TT
INNER JOIN TblAccounts TAS ON TAS.ACCOUNT = TT.SenderAccount
INNER JOIN TblAccounts TAR ON TAR.ACCOUNT = TT.ReceiverAccount
 
Thanks You =)
 

Users who are viewing this thread

Back
Top Bottom