Reputation: 199
I have this query:
SELECT (COUNT(*) = SUM(status in (3, 5)) ) AS result
FROM `match` WHERE round_id = 15
this essentially check if the table match
have all the items with a status 3
or 5
for the round 15
. This works, but I actually want add another condition, in particular if the result
is true
I want check that all the records of that table with round_id = 15
are 20
. How can I perform this?
Upvotes: 1
Views: 231
Reputation: 1269553
Is this what you want?
SELECT (COUNT(*) = SUM(status in (3, 5)) AND COUNT(*) = 20) AS result
FROM `match`
WHERE round_id = 15;
This checks that there are 20 rows that match the conditions.
Upvotes: 2