V
Very Rusty User
I'm using Access 2007.
I have 3 tables. The first is Invoices the second is Payments and the third
is PaymentAssignments (I’ll call it “PA†– it’s an intersection table between
the Invoices table and the Payments table).
I want my query to combine fields from both Invoices and PA and to return
ALL records from Invoices where the fields from PA are null (they are null
only if there is no matching record). (But I’m not trying to only get
Invoice records with no matching PA records – I want ALL Invoice records
regardless of whether there are any matching PA records).
So I LEFT JOIN Invoices to PA and add criteria “WHERE PA.Field1 is null.â€
But the problem is then I ONLY get Invoice records that have NO matching
record in PA.
With NO where clause, shouldn’t I get BOTH an Invoice record where the field
from PA is null AND all Invoice records where the field from PA is not null?
I’m only getting one Invoice record (the one where the field from PA is not
null).
Take Invoice #100, for example. If Invoice #100 has a matching record in PA
then my query with NO WHERE CLAUSE returns one record for Invoice #100.
Shouldn’t it return 2 records for Invoice #100 (one where PA.field1 is null
and one where PA.field1 is not null)?
What am I missing? Your help is appreciated, thanks!
I have 3 tables. The first is Invoices the second is Payments and the third
is PaymentAssignments (I’ll call it “PA†– it’s an intersection table between
the Invoices table and the Payments table).
I want my query to combine fields from both Invoices and PA and to return
ALL records from Invoices where the fields from PA are null (they are null
only if there is no matching record). (But I’m not trying to only get
Invoice records with no matching PA records – I want ALL Invoice records
regardless of whether there are any matching PA records).
So I LEFT JOIN Invoices to PA and add criteria “WHERE PA.Field1 is null.â€
But the problem is then I ONLY get Invoice records that have NO matching
record in PA.
With NO where clause, shouldn’t I get BOTH an Invoice record where the field
from PA is null AND all Invoice records where the field from PA is not null?
I’m only getting one Invoice record (the one where the field from PA is not
null).
Take Invoice #100, for example. If Invoice #100 has a matching record in PA
then my query with NO WHERE CLAUSE returns one record for Invoice #100.
Shouldn’t it return 2 records for Invoice #100 (one where PA.field1 is null
and one where PA.field1 is not null)?
What am I missing? Your help is appreciated, thanks!