这个查询有几个AssignmentId's
SELECT AS2.AssignmentId
FROM dbo.AssignmentSummary AS AS2
WHERE AS2.SixweekPosition = 1 AND AS2.TeacherId = 'mggarcia'
此查询仅通过变量获取一个赋值的值@assignmentId
SELECT S.StudentId,
CASE WHEN OW.OverwrittenScore IS NOT NULL
THEN OW.OverwrittenScore
ELSE dbo.GetFinalScore(S.StudentId, @assignmentId)
END AS FinalScore
FROM dbo.Students AS S
LEFT JOIN dbo.OverwrittenScores AS OW
ON S.StudentId = OW.StudentID
AND OW.AssignmentId = @assignmentId
WHERE S.ClassId IN (
SELECT C.ClassId
FROM Classes AS C
WHERE C.TeacherId = @teacherId
)
正如我所指出的,在最后一个查询中,当您通过变量分配一个值并返回一个表时。现在我想AssignmentId's
从第一个查询中得到一个包含几个的表。
我需要什么?连接表?我不知道现在该做什么。