假设表名为Persons。
可用如下sql语句
select distinct id from Persons where id not in (select id from Persons where num = 3);
备注:不加distinct,结果为3 3
加distinct,结果为3

select .... from ... where id <> 3;