我有2代表具有以下结构: -帮助中编写SQL查询的SQL Server
1)Student_Details: -
studentId(pk)
studentName
studentGrade
studentExamStatus
2)Student_Result: -
studentId(fk)
studentRank
数据仅在studentExamStatus
为P
时插入到第二个表中,否则如果studentExamStatus
为F
,则该第二个表中没有该学生的记录。
我想编写查询,它会给我所有学生的所有细节以及排名,如果没有排名空白数据或空值被提取。
我试图用正常的加入,但其只给我的学生排名,而不是所有的学生