我想要显示超过3个“出价”的所有“优惠”的“ArticleName”。应输出“出价”的数量。
我不知道怎么写下来。但我想我知道逻辑。它应该计算表“bid”和“OID”列的相同数字,最后它应该粘贴超过3的数字。
照片:
答案 0 :(得分:0)
SELECT * FROM (
SELECT o.ArticleName, count(b.BID) as numberOfBids
FROM Offer as o INNER JOIN bid as b ON o.oid = b.oid
GROUP BY o.ArticleName
) as c
WHERE c.numberOfBids > 3
答案 1 :(得分:0)
这很容易:
Select ArticleName
, count(*) NumberOfBids
from Offer o
join Bid b
on b.oid = o.oid
group by ARticleName
having count(*) >= 3