--try
select * from lesson
where (s_tp=1 and s_id not in (select s_vip from school))
or (s_tp=2 and s_id not in (select t_vip from teacher))
select * from lesson
where (s_tp=1 and s_id not in (select s_vip from school))
or (s_tp=2 and s_id not in (select t_vip from teacher))
你的条件我改成
(s_tp=1 and s_id not in (select if from school where s_vip=1))
or (s_tp=2 and s_id not in (select id from teacher where t_vip=1))谢啦。