子查询
一个查询的结果做为另一个查询的条件。
查询
select * from tbl_students
where age = (select max(age)
from tbl_students );
最大学生的信息
查询黑龙江省的所有市
select * from areas where parent_id = (select id from areas where name = '黑龙江省');
微信扫一扫
select * from tbl_students
where age = (select max(age)
from tbl_students );
select * from areas where parent_id = (select id from areas where name = '黑龙江省');
相关推荐