sql语句查询数据是和三张表有关联的应该怎么写?
展开全部
select
School.SchoolID,Student.StudentName
from
School
full
join
Class
on
School.ClassId=Class.ClassId
full
join
Student
on
Class.StudentId=Student.StudentId
要查找的东西放在最上面,然后连接表,连接条件。就这样。
School.SchoolID,Student.StudentName
from
School
full
join
Class
on
School.ClassId=Class.ClassId
full
join
Student
on
Class.StudentId=Student.StudentId
要查找的东西放在最上面,然后连接表,连接条件。就这样。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select
School.SchoolID,Student.StudentNamefrom
Student
left
join
Class
on
Student.StudentId
=
Class.Student
left
join
School
on
Class.ClassId
=
School.ClassId
School.SchoolID,Student.StudentNamefrom
Student
left
join
Class
on
Student.StudentId
=
Class.Student
left
join
School
on
Class.ClassId
=
School.ClassId
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询