|
本帖最后由 lastmem 于 2011-9-8 19:59 编辑
查询语句如下:
SELECT T.班级名称, T.姓名, T.组别名称, T1.科目名称, T1.成绩
FROM [SELECT 班级名称,姓名,A1.学生ID,A2.组别名称 from
(select 班级名称,姓名,C.学生ID from
(select 班级名称,学生ID from 班级信息 as a
inner join
[班级-学生] as b
on a.班级ID=B.班级ID)c
INNER JOIN
学生信息 as d
ON C.学生ID=D.学生ID)A1
INNER JOIN
(select 组别名称,C.学生ID from
(select 组别名称,学生ID from 组别信息 as a
inner join
[组别-学生] as b
on a.组别ID=B.组别ID)c
INNER JOIN
学生信息 as d
ON C.学生ID=D.学生ID)A2
ON A1.学生ID=A2.学生ID]. AS T INNER JOIN [SELECT 科目名称,成绩,学生ID from 科目信息 as A
INNER JOIN
成绩 AS B
ON A.科目ID=B.科目ID]. AS T1 ON T.学生ID = T1.学生ID;
============================================
问题如下
问题1:
(select 班级名称,学生ID from 班级信息 as a
inner join
[班级-学生] as b
on a.班级ID=B.班级ID)c
在这里 最后一个c的意思应该是 selest子句 as c
我想问的是为什么这里可以不加 AS
问题2:
整句简化为:
SELECT T.班级名称, T.姓名, T.组别名称, T1.科目名称, T1.成绩
FROM [select子句]. AS T INNER JOIN [select子句]. AS T1 ON T.学生ID = T1.学生ID;
这里为什么在SELECT子句外加“[ ].”。
|
|