使用自连接
使用自连接,from teachera, teacherb;然后设置筛选条件(b.dept=’A’ and a.sqlary>b.salary)
select * from teacher a,teacher b
where b.dept='A' and a.sqlary>b.salary
使用some或any
select name from teacher
where salary> some(
select salary from teacher where dept='A'
);
玩的
select id dept from inin where (id,dept)=(1,'A');
--等同于
select id dept from inin where id=1 and dept='A';