Using MS Access 2007
Table1
ID Date Time
001, 20091111, 141625
001, 20091112, 122345
001, 20091112, 180000
001, 20091113, 100000
001, 20091113, 120000
001, 20091113, 180000
001, 20091113, 160000
...,
From the above table i want to add one more column as a status. Status Should be In or Out. which Means For 20091111 - Only one time, So It should be 141625 - In For 20091112 - 2 times, So It should be 122345 - In, 180000 - Out For 20091113 - 4 times, So 10000 - In, 120000- Out, 180000 - Out, 160000 - In
Which means
Date with one time means, the time should be In,
Date with two times means, the First time should be In, Second time should be out
Date with three times means, the first time should be In, Second time should be out,
third time should be In.
Date with four times means, the first time should be In, Second time should be out,
third time should be In, Fourth time should be out.
For Example
Date Time
20091010 100000
20091010 180000
20091010 120000
It should order the date by ascending, then it will display First one In, Second One is Out, Third One is In.
Output.
Date Time Status
20091010 100000 In
20091010 180000 In
20091010 120000 Out
Expected Output
ID Date Time status
001, 20091111, 141625 In
001, 20091112, 122345 In
001, 20091112, 180000 Out
001, 20091113, 100000 In
001, 20091113, 120000 Out
001, 20091113, 180000 Out
001, 20091113, 160000 In
...,
How to make a access query for this condition?
Need Query Help