DEAR FRIENDS, Now am on a query in my HR application in employee attendance process. Here I have explained my requirements with sample data. First see my data format which shown below. I have a table which has employee daily attendance data including minutes workded,minutes late,minutes permission & Status. EMNO ADATE INTM OUTM M_WORK M_LATE M_PER STATUS 203 2010/04/01 510 0 0 l 203 2010/04/02 0830 1700 480 0 0 l 203 2010/04/03 0830 1700 480 0 0 l 203 2010/04/04 0 0 0 l 203 2010/04/05 0830 1700 480 0 0 l 203 2010/04/06 0830 1700 480 0 0 l 203 2010/04/07 0830 1700 480 0 0 l 203 2010/04/08 0830 1700 480 0 0 l 203 2010/04/09 0830 1700 480 0 0 l 203 2010/04/10 0830 1700 480 75 0 l 203 2010/04/11 0 0 0 l 203 2010/04/12 1358 2017 379 58 0 l 203 2010/04/13 0857 2210 763 27 0 l 203 2010/04/14 1343 1934 351 0 0 l 203 2010/04/15 0905 1947 612 35 0 l 203 2010/04/16 1426 2055 424 51 0 l 203 2010/04/17 1832 1944 644 0 0 l 203 2010/04/18 0 0 0 l 203 2010/04/19 0851 2024 663 21 0 l 203 2010/04/20 0906 2048 672 36 0 l The table contains 8 columns employee no,date,Intime , outtime,minutes worked,Minutes late,Minutes Permission & status. This is the sample daily attendance data for employee 203 for the month of 2010/04. Question : My query is for each pair of first minutes late date to be considered as one halfday,say for example the employee has come late for 75 minutes on 2010/04/10,58 minutes late on 12th,as like late minutes on 13th,15th,16th,19th & 20th.For each pair of two days to be considerd as one half day.for example Minutes late on 2010/04/10 & 2010/04/12 take these pair of two days and the mininum date(2010/04/10) to be considered as halfday this status to be updated as 'H'(H for half day) in the status column on the corresponding date(2010/04/10). The pair of days are, ADATE STATUS Pair 1 : 2010/04/10 H(HALF DAY) /* AM TAKEING THE MINIMUM DATE TO ASSIGN HALF DAY*/ : 2010/04/12 Pair 2 : 2010/04/13 H 2010/04/15 Pair 3 : 2010/04/16 H 2010/04/19 Non pair 4 : 2010/04/20(because there is no pair of minutes late day to make pair) so the status for this row to be considered as 'M'. Finally the non pair of day(2010/04/20) status to be considered as 'M' in the status column. Please tell me how to do this in forms 6i or sql query or procedure.