Kayleigh
Member
- Local time
- Today, 08:28
- Joined
- Sep 24, 2020
- Messages
- 709
Hi,
I'm back to work with my attendance database. The client requires more data manipulation and I'm really struggling to find the best way to achieve it.
The requirements are:
For each week (commencing sunday), find overall average of attendance for each student.
Currently we have each sessions' attendance data but must split each day into two - overall AM and PM. I have done this and now have two queries of summary data.
They also want a student to be marked as present even if they only attended one lesson in session - so basically I would need to find highest occurring value for each day and student in each query.
I managed to use the Min aggregate to get it almost working however it's not 100% accurate - usually min value is same as highest occurring value (because first attendance code is present so usually most of sessions are marked with this) but it may not always be the case. Can someone help me find the correct way to do this please. (I see a useful thread here but it is not sufficiently detailed for my scenario: https://www.access-programmers.co.uk/forums/threads/find-the-most-frequent-value.63008/)
Here is the SQL of what I have managed so far:
Also regarding the average aspect, can anyone advise a fair way to calculate so every student is given same chance ie if there are ten sessions a week (AM + PM x 5) each student's average should be calculated out ten (even if they don't have an attendance record for this session). Does this make sense?
Best,
Kayleigh
I'm back to work with my attendance database. The client requires more data manipulation and I'm really struggling to find the best way to achieve it.
The requirements are:
For each week (commencing sunday), find overall average of attendance for each student.
Currently we have each sessions' attendance data but must split each day into two - overall AM and PM. I have done this and now have two queries of summary data.
They also want a student to be marked as present even if they only attended one lesson in session - so basically I would need to find highest occurring value for each day and student in each query.
I managed to use the Min aggregate to get it almost working however it's not 100% accurate - usually min value is same as highest occurring value (because first attendance code is present so usually most of sessions are marked with this) but it may not always be the case. Can someone help me find the correct way to do this please. (I see a useful thread here but it is not sufficiently detailed for my scenario: https://www.access-programmers.co.uk/forums/threads/find-the-most-frequent-value.63008/)
Here is the SQL of what I have managed so far:
SQL:
SELECT qryAllStudentAttendanceRegCodesAM.fldStudentID, qryAllStudentAttendanceRegCodesAM.fldDate, Min(qryAllStudentAttendanceRegCodesAM.fldRegisterTypeID) AS MinOffldRegisterTypeID, Min(qryAllStudentAttendanceRegCodesAM.fldRegisterCodeID) AS MinOffldRegisterCodeID
FROM qryAllStudentAttendanceRegCodesAM
GROUP BY qryAllStudentAttendanceRegCodesAM.fldStudentID, qryAllStudentAttendanceRegCodesAM.fldDate;
Also regarding the average aspect, can anyone advise a fair way to calculate so every student is given same chance ie if there are ten sessions a week (AM + PM x 5) each student's average should be calculated out ten (even if they don't have an attendance record for this session). Does this make sense?
Best,
Kayleigh