SOでこれを見つけようとしました。
私はテーブルを持っています、
id | col2 | col3
---- ---- ----
5 smith (null)
5 smith 100
12 Jackson 356
12 Jackson 400
8 Johnson (null)
9 bob 1200
このシナリオでは、同じ ID に null 以外の行が 1 つしかないセットの行のみが必要です。つまり、スミスもジョンソンもいらない。ジャクソンとボブだけが欲しい。
私が試してみました、
select * from table
where is not null a
nd not exists (select * from table where is null)
私はそれを働かせることができません。