ISNULL(字段,0)用后无变化
selectdistinct
StudentName,
StudentNumber,
[NumberofCompletedExercise],
[AverageTime],
StudentID
from#PersonList
leftjoin(selectPersonID,ISNULL(count(Completed),0)as[NumberofCompletedExercise]
fromUserTransaction.UserExercises
groupbyPersonID)M
onM.PersonID=#PersonList.StudentID
leftjoin(selectPersonID,UserExerciseIDfromUserTransaction.UserExercises)Q
onQ.PersonID=#PersonList.StudentID
leftjoin(selectUserExerciseID,ISNULL(avg(seconds),'')as[AverageTime]
fromUserTransaction.UserExerciseTime
groupbyUserExerciseID)N
onN.UserExerciseID=Q.UserExerciseID
orderbyStudentNumber
END
GO
运行后空值没有变为0,