How to put in text box?

Hello! I made a crosstab query in which you specify totals.59d0bb1a113ee175813105.png
Query:
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;

One total field to add up all "-1", and the second all "L".
Sum does not work in this case, put yet Min.
June 14th 19 at 21:04
1 answer
June 14th 19 at 21:06
Solution
Using IIF() can take desired values.
https://docs.microsoft.com/en-us/sql/t-sql/functio...
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;

Find more questions by tags Microsoft Access