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
------解决方案--------------------
SQL code
use studentInfo
select
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_id
inner join
score c
on
a.Course_id=c.Course_id
------解决方案-------------------- 一个innser join后面要跟一个on。
------解决方案--------------------
SQL code
use studentInfo
go
select 学号= a.Student_id,
姓名=a.Student_name,
课程名=b.Course_name,
成绩=c.Grade
from student a inner join score c on a.Student_id=c.Student_id
inner join course b on b.Course_id=c.Course_id
--或者
use studentInfo
go
select 学号= 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
------解决方案--------------------
------解决方案-------------------- 每个join 后面跟on,不能写在一起
------解决方案-------------------- a.Student_id AS 学号 a.Student_name AS 姓名 b.Course_name AS 课程名 c.Grade AS 成绩 还有inner join 后面要接ON (LZ语法要规范哦!)