Re: Inner join on table with NULL's
- From: "Ken Snell \(MVP\)" <kthsneisllis9@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Aug 2006 15:03:39 -0400
"Carl Colijn" <carl.colijn@xxxxxxxxx> wrote in message
news:nlJEg.4842$YI3.1209@xxxxxxxxxxxxx
< snipped >
The problem is that Access (and I believe all SQL implementations) cannot
deal with NULL values at all when using a JOIN, so that "table1.column =
table2.column" cannot be used as a join condition if they both contain
NULL (NULL <> NULL in SQL, by design I believe).
Anyway, thanks for the suggestion,
Kind regards,
Carl Colijn
The "trick" in this case is to use "nonequijoin" utilizing the Nz function
to replace a Null value with a "unique" value that will tell you the value
is Null. For example, suppose that the field contains only positive
number -- you could use a query like this:
SELECT T1.*, T2.*
FROM Table1 AS T1
INNER JOIN Table2 AS T2
WHERE Nz(T1.FieldName, -100) =
Nz(T2.FieldName, -100);
Similar steps could be used for text:
SELECT T1.*, T2.*
FROM Table1 AS T1
INNER JOIN Table2 AS T2
WHERE Nz(T1.FieldName, "MyNullValue") =
Nz(T2.FieldName, "MyNullValue");
--
Ken Snell
<MS ACCESS MVP>
.
- Follow-Ups:
- Re: Inner join on table with NULL's
- From: Carl Colijn
- Re: Inner join on table with NULL's
- References:
- Inner join on table with NULL's
- From: Carl Colijn
- RE: Inner join on table with NULL's
- From: JKarchner
- Re: Inner join on table with NULL's
- From: Carl Colijn
- Inner join on table with NULL's
- Prev by Date: Re: Date and Time query
- Next by Date: How to pass parameter between parameter queries
- Previous by thread: Re: Inner join on table with NULL's
- Next by thread: Re: Inner join on table with NULL's
- Index(es):
Relevant Pages
|