Hi
I have a database table that logs the progress of a persons application form from receiving the form in the office through to attending an interview. What I would like to do is produce a query that will show me the dates when each stage was reached and the number of days between the stages so that I can monitor service standards. For example, acknowledgment of receiving a form should be sent within 7 days of receiving the form. The data is held in a table like follows;
Sequence_Num, Stage, Date, Person_ID
1 AA 20/01/2008 231
2 AACK 25/01/2008 231
3 AACK 23/01/2008 231
4 INT 27/01/2008 231
What I would like to do is group the records by person_ID, then display the date each stage was reached. Like follows;
Person_id AA AACK INT
231 20/01/2008 23/01/2008 27/01/2008
The problem i have is that there may be cases where there are two entries for a particular stage. AACK in the example above. It may be that it is logged on the system that an acknowledgment was sent on 25th Jan, this however might have been entered in error. The correct date was the 23rd. I would only want to show the one entry in my query. If there are two rows with the same stage, code ‘AACK’ for example, then I would like to display the date with the highest sequence number. This is where I get a bit stuck! Can anyone help?
I guess I need to include a sub query that displays the date for the max of sequence number for that stage. Im struggling to come up with anything though
I have a database table that logs the progress of a persons application form from receiving the form in the office through to attending an interview. What I would like to do is produce a query that will show me the dates when each stage was reached and the number of days between the stages so that I can monitor service standards. For example, acknowledgment of receiving a form should be sent within 7 days of receiving the form. The data is held in a table like follows;
Sequence_Num, Stage, Date, Person_ID
1 AA 20/01/2008 231
2 AACK 25/01/2008 231
3 AACK 23/01/2008 231
4 INT 27/01/2008 231
What I would like to do is group the records by person_ID, then display the date each stage was reached. Like follows;
Person_id AA AACK INT
231 20/01/2008 23/01/2008 27/01/2008
The problem i have is that there may be cases where there are two entries for a particular stage. AACK in the example above. It may be that it is logged on the system that an acknowledgment was sent on 25th Jan, this however might have been entered in error. The correct date was the 23rd. I would only want to show the one entry in my query. If there are two rows with the same stage, code ‘AACK’ for example, then I would like to display the date with the highest sequence number. This is where I get a bit stuck! Can anyone help?
I guess I need to include a sub query that displays the date for the max of sequence number for that stage. Im struggling to come up with anything though