我们有以下表格:
**Product**
Productnr
**Deliverable**
Deliverernr
Productnr
**Deliverer**
Deliverernr
产品与交付者之间的关系是多对多的,而交付者是其交汇表
我正在尝试显示仅由一个送货员提供的所有产品
我尝试了以下方法,但均未成功:
SELECT Product.Productnr
FROM Product, Deliverable, Deliverer
WHERE Product.Productnr = Deliverable.Productnr AND
Deliverer.Deliverernr = Deliverable.Deliverernr
HAVING COUNT(Product.Productnr) = 1;
我正在使用MS Access
在此先感谢您的帮助。
我不知道为什么只有一个交汇点并且想要特定结果取决于交汇点的两个变量时为什么需要使用所有表,所以我可能错了。如果有帮助,请尝试以下操作:
SELECT Productnr FROM Deliverable GROUP BY Productnr HAVING COUNT (Deliverernr)=1
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句