个人日常

来源:互联网 发布:宇宙巨校闪级生 知乎 编辑:程序博客网 时间:2024/05/17 23:16
USE MySchool2
GO


DECLARE @StuNo int 
select @StuNo='20011' 


--select * from Student where StudentNo=@StuNo
DECLARE @NUM int
select  @NUM=DATEPART(YEAR,BornDate)
 from Student where StudentNo=@StuNo
 
select * from Student where (DATEPART(YEAR,BornDate)=@NUM+1) OR (DATEPART(YEAR,BornDate)=@NUM-1)
原创粉丝点击