根据索引条件查询结果与原表关联的查询

select
  t1.id
  , t1.t_class
  , t1.teacher
from
  t_class t1
  left join (select * from t_class where id=1) t2
    on t1.t_class = t2.t_class
    and t1.id = t2.id
where t2.id is null

图1 为:表数据

图2为:表结构

图3为:查询结果

 

原文地址:https://www.cnblogs.com/kukai/p/11129126.html