B
B
bender30002017-10-01 12:59:08
Microsoft Access
bender3000, 2017-10-01 12:59:08

How to stack in a text field?

Hello! I made a cross query in which you need to specify the total values. 59d0bb1a113ee175813105.png
Request:

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;

It is necessary to add all "-1" in one final field, and all "L" in the second.
Sum does not work in this case, so far I have set Min.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Holub, 2017-10-01
@bender3000

With the help of IIF () you can catch the 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;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question