我想在表中找到所有ID,其中“ FALSE”是具有该ID的每一行的另一列中的值。在屏幕截图中:
我只想取回“ AFERRIERA”和“ AHANLON”,因为对于IDENTITY列中的每一行,“ METHOD_DEFAULT”列均为“ FALSE”
答案 0 :(得分:1)
好的,我解决了:
SELECT DISTINCT IDENTITY
FROM PERSON_INFO_COMM_METHOD2 t
WHERE METHOD_DEFAULT = 'FALSE'
AND NOT EXISTS (SELECT * FROM PERSON_INFO_COMM_METHOD2 WHERE METHOD_DEFAULT <> 'FALSE'
AND IDENTITY = t.IDENTITY)