Hiren Raiyani
Hiren Raiyani

Reputation: 744

How to add where clause in access join query

I have query like this.

SELECT account.AccountNumber, account.Name, Sum(agro.price*agro.qty) AS Expr1
FROM account,data  INNER JOIN (agro INNER JOIN data ON agro.BillNo = data.BillNo) ON    
account.AccountNumber = data.acno
GROUP BY account.AccountNumber, account.Name;

I want to add where db='true' this columns is of 'data' table then how can i do pls help me?

Upvotes: 1

Views: 3053

Answers (1)

Filipe Silva
Filipe Silva

Reputation: 21657

Try this:

SELECT account.AccountNumber, account.NAME, Sum(agro.price * agro.qty) AS Expr1
FROM ((account
INNER JOIN data ON account.AccountNumber = data.acno)
INNER JOIN agro ON agro.BillNo = data.BillNo)
WHERE data.db='true'
GROUP BY account.AccountNumber, account.NAME;

You had some confusion in your JOINs, but i think this is what you were aiming for

Upvotes: 2

Related Questions