create table incre_table (AutoIncreID int);
insert into incre_table values (1);
insert into incre_table values (2);
insert into incre_table values (3);
insert into incre_table values (4);
insert into incre_table values (5);
insert into incre_table values (6);
SELECT * from tb_project_category_two where id not in( SELECT pid from
(SELECT pid from project_list) a
union
(select substring_index(substring_index(a.other_id,',',b.AutoIncreID),',',-1) as pid
from
(SELECT * from `project_list` where LENGTH(other_id)>0 ) AS a
join
incre_table b
on b.AutoIncreID <= (length(a.other_id) - length(replace(a.other_id,',',''))+1)
order by a.pid) )
参考 https://www.cnblogs.com/Yongzhouunknown/p/4844267.html