我有以下(缩短查询):
SELECT `Statistics`.`StatisticID`, COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount` FROM `Statistics` LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID` WHERE `FlagCount` = 0 GROUP BY `Statistics`.`StatisticID` ORDER BY `SubmittedTime` DESC LIMIT 0, 10
现在,无论是FlagCount = 0
或COUNT(Flags.FlagType)
在工作中WHERE
的条款.我想过使用a,SET
但我不确定如何将其添加到查询中.有任何想法吗?
谢谢,
使用HAVING COUNT(DISTINCT Flags.FlagType) = 0
.