Senin, 20 Juli 2015

[MS_AccessPros] How to query record considering modification date

 

Good evening to all, 

I have a question, I try to explain hoping that  somebody can give me some solution as happen in the past.

 

I have a  2 tables, one  main table  that I call  Tblopencredit and another one called TblopencreditOLD that stock  previous version of the record and it  is fulfilled each time the records  in main table, change.

 

The table  has the following fields:

  1. key

  2. information field

  3. creation date

  4. modification date

each time the record  in table Tblopencredit is changed, the previous record is copied and saved in table  tblopencreditSTO and the date when change occur  is reported in "modification date" field  of tblopencreditSTO.

 

 

below one example of record in  tblopencredit

(the format of the date is dd/mm/yyyy)

 

                             

1; 900; 03/03/2015;10/07/2015;

2;1000; 1000; 11/02/2015; 11/02/2015

3;1500; 06/07/2015; 11/02/2015

 

In reality in my database the date  is reported also with seconds that I deleted to simplify

 

 

Below an example of tblopencreditSTO where the record with key 1 has been changed 3 times and the other record did not have any change and consequently there are no record in tblopencreditSTO

 

 

1;1000; 03/03/2015;10/07/2015

1;800; 03/03/2015; 15/07/2015

1;200; 03/03/2015; 18/07/2015

 

 

My goal is   retrieve the data how was in a precise given date

 

For example if I want to know how was data the 17/07/2015 (July 17)

 

 

This mean that I need to take the record 1 in tblopencreditSTO (second position with changing date:  15/07/2015)

And for record 2 and 3 I need to take the data in tblopencredit because the record were created before the query date and did not occur   any modification.

 

I can also merge the two tables in only one table but I need a way to extract only one record for each key that fit my question "How was the data in a certain date)

 

 

Any Idea?

 

Thank you

 

 Valentino

 


__._,_.___

Posted by: Valentino Avvisati <valentino.avvisati@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar