关于SQl的查询语句

来源:百度知道 编辑:UC知道 时间:2024/06/14 11:33:05
查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。

select a.sno,a.sname,a.sbirthday
from
table a,table b
where
year(a.Sbirthday)=year(b.Sbirthday)
and
b.sno=108

select Sno,Sname,Sbirthday
from 表名
where (year(Sbirthday)=(select year(Sbirthday) from 表名 where Sno=108))

select Sno,Sname,Sbirthday from table where table.Sbirthday=(select Sbirthday from table where id=108);
注:table为你存放信息的表;

select sno,sname,sbirthday from table where 出生日期=你要查的日期 and 学号 like '%108%'