首页 > 代码库 > mysql 子查询

mysql 子查询

1.标量子查询

select *from myuser where classid=
(
select classid from myclass
where classname=‘2班‘
)

2.列子查询

select *from myuser where classid in
(
select classid from myclass
)

3.行子查询


SELECT * from myuser
where (classid,age)=
(
select max(classid),min(age)
from myuser
)

mysql 子查询