我正在使用此查询来计算从当前学期到上一学期的入学总数百分比变化。我需要对此查询进行哪些更改以避免空值?我尝试过使用非常缓慢的子查询。
SELECT E2.Term AS Prev_Term,
E2.[Enrollment Total] AS Prev_Enrl_Tot,
E1.Term,
E1.Location,
E1.milestone_description,
E1.polling_date,
Round(((E1.[Enrollment Total] - [Prev_Enrl_Tot])
/ [Prev_Enrl_Tot]) * 100,2) AS Percent_Change
FROM EnrollmentsByLocation E1
LEFT OUTER JOIN EnrollmentsByLocation E2
ON E1.Location = E2.Location
AND E1.milestone_description = E2.milestone_description
AND E1.Term - E2.Term = 1;