Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个查询:
SELECT (COUNT(*) = SUM(status in (3, 5)) ) AS result FROM `match` WHERE round_id = 15
这实质上是检查表中match是否包含所有具有状态3或5回合的项目15。这可行,但我实际上想添加另一个条件,特别是如果result我true想检查该表的所有记录round_id = 15是否为20。我该怎么做?
match
3
5
15
result
true
round_id = 15
20
这是你想要的吗?
SELECT (COUNT(*) = SUM(status in (3, 5)) AND COUNT(*) = 20) AS result FROM `match` WHERE round_id = 15;
这将检查是否有 20 行符合条件。