C
CHANG
Hi,
I don't know if this is possible to use query/or macro to consolidate
data in the same table, and delete the duplicate one. My table looks
like below:
record [ID1], [ID2], [update_date], [start_date], [end_date], [notes]
1 A , 123 , 20080101 , 20070101 , 20091231 , manual
input
2 A , 123 , 20090101 , 20081201 , 20091031 , manual
input
3 A , 123 , 20100101 , 20091101 , 20100731 , manual
input
4 A , 123 , 20100801 , 20100101 , 20101231 , manual
input
5 A , 456 , 20100801 , 20100101 , 20101231 , manual
input
My goal is to consolidate the first 4 records to 1 at the max of
[update_date], which will take min of [start_date] and max of
[end_date], but select the records only when [ID1] is the same and
[ID2] is the same. Therefore the 5th record won't be changed.
record [ID1], [ID2], [update_date], [start_date], [end_date], [notes]
1 A , 123 , 20080101 , 20070101 , 20091231 , manual
input
2 A , 123 , 20090101 , 20081201 , 20091031 , manual
input
3 A , 123 , 20100101 , 20091101 , 20100731 , manual
input
4 A , 123 , 20100801 , 20070101 , 20101231 , manual
input <----
5 A , 456 , 20100801 , 20100101 , 20101231 , manual
input
Then delete the first 3 records, maybe somehow can use query to
identify the first 3 records, and replace txt in [notes] to * ? I have
a simple delete query to delete * in [notes] already.
record [ID1], [ID2], [update_date], [start_date], [end_date], [notes]
1 A , 123 , 20080101 , 20070101 , 20091231 ,
* <----
2 A , 123 , 20090101 , 20081201 , 20091031 ,
* <----
3 A , 123 , 20100101 , 20091101 , 20100731 ,
* <----
4 A , 123 , 20100801 , 20070101 , 20101231 , manual
input
5 A , 456 , 20100801 , 20100101 , 20101231 , manual
input
Could any one share the knowledge if it is doable?
Thank you,
Vincent
I don't know if this is possible to use query/or macro to consolidate
data in the same table, and delete the duplicate one. My table looks
like below:
record [ID1], [ID2], [update_date], [start_date], [end_date], [notes]
1 A , 123 , 20080101 , 20070101 , 20091231 , manual
input
2 A , 123 , 20090101 , 20081201 , 20091031 , manual
input
3 A , 123 , 20100101 , 20091101 , 20100731 , manual
input
4 A , 123 , 20100801 , 20100101 , 20101231 , manual
input
5 A , 456 , 20100801 , 20100101 , 20101231 , manual
input
My goal is to consolidate the first 4 records to 1 at the max of
[update_date], which will take min of [start_date] and max of
[end_date], but select the records only when [ID1] is the same and
[ID2] is the same. Therefore the 5th record won't be changed.
record [ID1], [ID2], [update_date], [start_date], [end_date], [notes]
1 A , 123 , 20080101 , 20070101 , 20091231 , manual
input
2 A , 123 , 20090101 , 20081201 , 20091031 , manual
input
3 A , 123 , 20100101 , 20091101 , 20100731 , manual
input
4 A , 123 , 20100801 , 20070101 , 20101231 , manual
input <----
5 A , 456 , 20100801 , 20100101 , 20101231 , manual
input
Then delete the first 3 records, maybe somehow can use query to
identify the first 3 records, and replace txt in [notes] to * ? I have
a simple delete query to delete * in [notes] already.
record [ID1], [ID2], [update_date], [start_date], [end_date], [notes]
1 A , 123 , 20080101 , 20070101 , 20091231 ,
* <----
2 A , 123 , 20090101 , 20081201 , 20091031 ,
* <----
3 A , 123 , 20100101 , 20091101 , 20100731 ,
* <----
4 A , 123 , 20100801 , 20070101 , 20101231 , manual
input
5 A , 456 , 20100801 , 20100101 , 20101231 , manual
input
Could any one share the knowledge if it is doable?
Thank you,
Vincent