SQL server 中三个表连接查询的语句这样写对吗?
use studentInfo
select 学号= a.Student_id,
姓名=a.Student_name,
课程名=b.Course_name,
成绩=c.Grade
from student a inner join course b inner join score c
on a.Student_id=c.Student_id
on b.Course_id=c.Course_id
这样写对吗?
[解决办法]
select a.Student_id as 学号
...
from student a inner join course b
on a.Student_id=c.Student_id
inner join score c
on b.Course_id=c.Course_id
[解决办法]
use studentInfoselect a.Student_id as 学号, a.Student_name as , b.Course_name as 课程名, c.Grade as 成绩 from student a inner join course b on a.Student_id=b.Student_idinner join score con a.Course_id=c.Course_id
[解决办法]
一个innser join后面要跟一个on。
[解决办法]
use studentInfogoselect 学号= a.Student_id, 姓名=a.Student_name, 课程名=b.Course_name, 成绩=c.Grade from student a inner join score c on a.Student_id=c.Student_idinner join course b on b.Course_id=c.Course_id--或者use studentInfogoselect 学号= a.Student_id, 姓名=a.Student_name, 课程名=b.Course_name, 成绩=c.Grade from student a , score c , course b where on b.Course_id=c.Course_id,a.Student_id=c.Student_id
[解决办法]