Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Location
    USA
    Posts
    66

    Unanswered: combine two records

    Greetings,
    I was trying to combine records from two exact same databases into one.

    The table has:
    ID as number data type and
    SiteID as number data type

    They made a copy of the database and one user enters in the SiteID field starting with 1000 and the second user enters in the SiteID field starting with SiteID 2000. I was trying to combine these two SiteID so that they can see all in one database. The plan is to put the back end (tbl) in a server...

    Any help would be greatly appreciated

  2. #2
    Join Date
    Oct 2003
    Posts
    66
    So you want to combine the records from the two databases into one table? Example, you have db1.mdb and db2.mdb both with a table called table1. You want table1 in db1.mdb to have all the records it currently has pluss all the records from table1 in db2.mdb.

    There are probably several ways to do this. Here is how i would go about it. In db1 import table1 from db2. if they have the same name then it will put a 1 after the name of the imported table. Then i would write a simple append query to move records from your newly imorted table into the existing table.

    SQL for query would look something like this:
    (assuming you are folowing the above naming convention in my example)

    INSERT INTO Table1
    SELECT *
    FROM Table11

    Table11 is the imoprted table
    Table1 is the existing table

    Hope this helps

  3. #3
    Join Date
    Sep 2002
    Location
    USA
    Posts
    66

    combining records

    Where exactly do I put the SQL syntax mentioned above?
    and is the the data type ID as number and SiteID as number ok?

    Thanks for your help!

  4. #4
    Join Date
    Oct 2003
    Posts
    66
    Where to put SQL syntax:
    The SQL would be put in a query's SQL view window. Basically created a new query and then goto the SQL view of that query. Paste the code in that window. You will have to change the table names to match the names you use in your database. Once the query is creatred yo will have to run it for it to append the records. I suggest doing this from a Test copy of your production database incase you get unexpected results.

    As far as you quesiton on data types for your fields. If ID and SiteID will never need to contain anyhting other than numeric characters then i don't see why a number type would be an issue. It really depends on how they will be used though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •