Neil Toulouse
Programmer
Hi guys
I'm thinking this should be a straightforward query but I'm at a loss at the mo!
Basically, I have an 'Attendance' table, something like this:
What I am trying to achieve is a distinct list of 'ENRID' where their last two sessions 'DATE' (reverse chronological order) are 'not attended' (Attended=0)
...so from the example data, the query should return ENRID 1 & 4, and not ENRID 2 & 3.
Can you help?
TIA
Neil
I like work. It fascinates me. I can sit and look at it for hours...
I'm thinking this should be a straightforward query but I'm at a loss at the mo!
Basically, I have an 'Attendance' table, something like this:
Code:
ENRID DATE ATTENDED
1 24/03/2017 0
1 23/03/2017 0
1 22/04/2017 1
1 21/04/2017 1
2 24/03/2017 1
2 23/03/2017 1
2 22/04/2017 1
2 21/04/2017 1
3 24/03/2017 1
3 23/03/2017 0
3 22/04/2017 0
3 21/04/2017 1
4 24/03/2017 0
4 23/03/2017 0
4 22/04/2017 1
4 21/04/2017 1
What I am trying to achieve is a distinct list of 'ENRID' where their last two sessions 'DATE' (reverse chronological order) are 'not attended' (Attended=0)
...so from the example data, the query should return ENRID 1 & 4, and not ENRID 2 & 3.
Can you help?
TIA
Neil
I like work. It fascinates me. I can sit and look at it for hours...