1

I need a query that displays all data from two tables, and not all records on Table A have matching records on table B. By default, the query only displays records that match other records in the tables involved (not unmatched ones).

I want the query to show both: records with matched records in the other table, as well as ones that have no matching recors on the other table.

Is this possible? If so, how can that be made? Thanks.

2 Answers 2

2

The first query is an A left join B. The second query is a B left join A where A.joinfield Is Null. The order of the fields in the second query is the same as in the first query. Then you put these two queries in the Union query.

2
  • Thanks, I understand that my problem has to do with how the tables are joined first. To specify which table goes first, do I need to know SQL? I try, but it seems to me that my queries' SQL needs to be edited.
    – Andrw
    Apr 8, 2016 at 14:19
  • Your task is not so complicated that you have to know SQL in detail. Please provide us with your query (the union query), then we can check whether it works, or not. Or would you prefer to see an example?
    – Rainer
    Apr 10, 2016 at 12:19
0

One possibility is to:

  • Create a query that only displays matched records (as happens by default).

  • Then, create a second query with criteria "Is Null", when filtering records for the needed fields.

Finally, create a "union query" (some SQL may be involved) that displays the data from both the first query and the second query.

I'm having trouble getting this to work though: The second query displays no records when I include the "Is Null" command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .