TRANSFORM Min(last.absent) AS [Min-absent]
SELECT last.studentid, Min(last.absent) AS Total_Absents, Min(last.absent) AS Total_Lates
FROM [last]
GROUP BY last.studentid
PIVOT last.am_day;
TRANSFORM Min(last.absent) AS [Min-absent]
SELECT last.studentid, SUM(IIF(last.absent="-1", 1, 0)) AS Total_Absents, SUM(IIF(last.absent="L", 1, 0)) AS Total_Lates
FROM [last]
GROUP BY last.studentid
PIVOT last.am_day;