简单子查询

select *from Student
--使用局部变量查询出生日期比张飞的人的信息
declare @Born nvarchar(20) --声明局部变量
select @Born=Birthday from Student where StuName='张飞'
select StuNo,StuName ,Birthday,Address from Student where Birthday>@Born
--子查询
select StuNo,StuName ,Birthday,Address from Student
where Birthday>(select Birthday from Student where StuName='张飞')

原文地址:https://www.cnblogs.com/sujulin/p/6546764.html