Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    67

    Unanswered: Create a Query; all records including matching records

    I am trying to create a Query from two tables (Table1 and Table2). Each table has the same field names for Field1, Field2, and Field3. I am trying to create a Query which contains all records for Table1 but only those records for Table2 which match Table1's Field1 records. When I create a Select Query with a relationship between the two Field1's, I only get the records that match for both Table1 and Table2. I lose all the Table1 records for which Field1 does not equal Table2's Field2.

    Does anyone know how I would go about creating a Query for these two Tables where I do not lose the non-matching Table1 records. For example assume: Table 1/Field1 = 1,2,3,4,5 and Table2/Field1 = 4,5. My current Query only shows the 4,5 records with Field1, Field2 and Field3 for each Table. I need to show all of the Table1 1,2,3,4,5 records and the Table2 4,5 records. I understand that Field2 and Field3 will be "null" for Table2.

    Either a VBA or manual solution would be much appreciated.

    Thanks much for any help.

    Jim

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Access 2002,

    Select *
    from table1 t1
    LEFT OUTER JOIN
    table2 t2 ON
    t1.id = t2.id;
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Feb 2004
    Posts
    67
    Originally posted by r123456
    Access 2002,

    Select *
    from table1 t1
    LEFT OUTER JOIN
    table2 t2 ON
    t1.id = t2.id;

    r123456,

    Thanks much. I will try first thing in the morning. I am calling it quits for the day.

    Jim

Posting Permissions

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