Results 1 to 5 of 5

Thread: Access question

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Location
    Auckland, New Zealand
    Posts
    21

    Cool Access question

    Hi there, this is a question concerning merging 2 tables in Access.

    I have 2 tables with a common field "timestamp".

    Table 1 has timestamp, field 1, field 2.
    Table 2 has timestamp, field A, field B (for example).

    New table will have timestamp, field 1, field 2, field A, field B and the records will be made from records in the 2 original tables with common timestamp values.

    How do I do that?

    Thanks!!

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Try something like this:


    Select field1, field2, FieldA, FieldB From Table1, Table2 Where Table1.TimeStamp = Table2.TimeStamp

  3. #3
    Member
    Join Date
    Mar 2001
    Posts
    60

    Reply

    The sort of thing that u have to do is a create a query and add both tables and all the fields from both tables and that should work (Note: do not query anything)
    What is Life? One big dream or one Big nightmere.

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    If I am understanind you right, you want to do the following

    Table 1 data
    ----------------
    "Hello", "World", "Hi"
    "Isn't", "She", "Lovely"


    Table 2 data
    ----------------
    "I've", "Got", "A"
    "Lovely", "bunch","Of"
    "Coconuts","he","he"

    and combine the two to form

    Table 3 Data
    ----------------
    "Hello", "World", "Hi"
    "Isn't", "She", "Lovely"
    "I've", "Got", "A"
    "Lovely", "bunch","Of"
    "Coconuts","he","he"

    Is that right? To do that you need to use a UNION query. This is the syntax:
    Code:
    SELECT Table1.Field1, Table1.Field2, Table1.Field3 FROM Table1
    UNION ALL SELECT  Table2.Field1, Table2.Field2, Table2.Field3 FROM Table2;
    Hope that helps!

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Location
    Auckland, New Zealand
    Posts
    21
    Thanks, that worked fine, I used:
    select table1.*, table2.* from table1, table2 where table1.date/time = table2.date/time
    Then I turned it into a "Make Table Query" to make my new table.

    Nice one!

Posting Permissions

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



Click Here to Expand Forum to Full Width