我使用SQL Server 2008和我有4个表StudentAbsentees, Students, StudentSections
和Sections
SQL内两个表
在StudentAbsentees
表我存储studentId
是不存在的某一天像(仅缺席),
StudentId Time Date
----------- ------ ------
1 10:00 2012-04-13
并在StudentSections
我在一个特定的部分存储所述studentId
等
StudentId SectionId
---------- ------------
1 1
2 1
3 1
和Students
表中我存储学生详细信息,同样在Sections
表中,我具有该部分的名称和容量等部分详细信息。
我需要加入这些表并显示该学生是否存在/不存在的某一天......结果应该是
StudentId Status
--------- ------
1 Absent
2 Present
3 Present
我可以从这些表的缺席名单,我不知道怎么样以显示它们是否存在/不存在....谁能帮我在这里
其显示错误,如'是'附近的无效语法,如果我删除sa。[日期]它的工作,但输出是错误的 – shanish 2012-04-13 18:48:41
@Shanish:请尝试我编辑的答案。 – 2012-04-13 19:01:47
感谢您的回复juergen,其显示所有的状态为“缺席” – shanish 2012-04-13 19:06:20