A query in which a field satisfies multiple criteria simultaneously
- 2020-05-10 23:02:40
- OfStack
So you have to do something special.
Here count(*) = 3 means
In the results of the query, only result sets with three pieces of data per group after grouping by group are found
SELECT * FROM news_extinfo
where
(ExtID = 1 and OptionValue = 0)
or (ExtID = 2 and OptionValue = 0 )
or (ExtID = 3 and OptionValue = 0 )
group by NewsID
having count(*)=3
Here count(*) = 3 means
In the results of the query, only result sets with three pieces of data per group after grouping by group are found