我有这个查询,我想选择那个选择的反函数。
SELECT Guide.id FROM Guide INNER JOIN GuideAvailability ON Guide.id = GuideAvailability.guideId WHERE GuideAvailability.startDate IN (1377946800) GROUP BY GuideAvailability.guideId HAVING COUNT(DISTINCT GuideAvailability.id) = 1
有没有简单的方法可以解决我的问题?
只需使用以下查询:
SELECT * FROM Guide where id NOT IN ( SELECT Guide.id FROM Guide INNER JOIN GuideAvailability ON Guide.id = GuideAvailability.guideId WHERE GuideAvailability.startDate IN (1377946800) GROUP BY GuideAvailability.guideId HAVING COUNT(DISTINCT GuideAvailability.id) = 1 )