我已经运行了这两个看起来像他们做同样事情的查询,但给出了不同的结果:
SELECT COUNT(stage1) AS total
FROM progress_status
WHERE stage1 = 3
AND stage2 != 3 AND stage3 !=3 AND stage4 !=3 AND stage5 !=3;
# total = 90
SELECT COUNT(stage1) AS total
FROM progress_status
WHERE stage1 = 3
AND (stage2,stage3,stage4,stage5) != (3,3,3)
# total = 314
最佳答案
第二个是:
AND (stage2 != 3 OR stage3 !=3 OR stage4 !=3 OR stage5 !=3);