Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Combining two similar tables in MS Access

  • 25-03-2004 7:30pm
    #1
    Registered Users, Registered Users 2 Posts: 245 ✭✭


    I have two tables with the same column and row headers. One table was updated with new values and the other was not. I need to make sure the latest table has the most uptodate data. so how can i get the data changes into the latest table. I know you are probably thinking, why don't we use the latest table. Well, the problem is that both tables have been worked in at some point. So we need to make one table out of the two of them.

    Thanks


Comments

  • Closed Accounts Posts: 3,357 ✭✭✭secret_squirrel


    I assume you have some way of identifying which rows you want from each table (eg an update flag or a timestamp)

    Copy the structure of one of your tables to a new table, (copy paste should do it.)

    Right assumming the each table has you have 3 fields, a data value, and a timestamp you want something like this :

    insert into table3 (
    Select a.field1,b.field2, c.field3, iif(a.timestamp>b.timestamp,a.value,b.value), iif(a.timestamp>b.timestamp,a.timestamp,b.timestamp)
    from table1 a, table2 b
    where a.field1 = b.field1
    and a.field2 = b.field2
    and a.field3 = b.field3);

    This should work - my MS Sql is very rusty tho... so anyone else feel free to correct me.....


Advertisement