如何在访问连接查询中添加where子句

时间:2013-12-02 14:53:01

标签: ms-access ms-access-2007

我有这样的查询。

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;

我想添加其中db ='true'此列是'数据'表格,那我该怎么办请帮助我?

1 个答案:

答案 0 :(得分:1)

试试这个:

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;

你的JOIN中有一些混乱,但我认为这是你的目标