T
tryit
Suppose I have two tables:
Table 1:
ID a b c
1 1 2
2 3 4
3 5 6
4 7 8 9
Table2
ID a b c
1 1 2
2 3 4
3 5 6
4 7 8 9
The following SQL:
SELECT Table1.ID, Table2.ID
FROM Table1 INNER JOIN Table2
ON (Table1.c = Table2.c)
AND (Table1.b = Table2.b)
AND (Table1.a = Table2.a);
Returns:
Table1.ID Table2.ID
4 4
I do want these tables connected by inner joins not left or right (in
other words I want only those records where all the joined fields are
equal to be returned). It seems that when the records contain
matching blank (null) fields that that is not considered a match.
How do I get the records with matching null fields to be returned with
the query?
I seem to have missed a fundamental concept about SQL. I would have
assumed that if two records contain nulls in joined fields that, given
all other fields are equal, they would match. Apparently not, so my
question is how do I force this behavior?
Thanks,
Tom
Table 1:
ID a b c
1 1 2
2 3 4
3 5 6
4 7 8 9
Table2
ID a b c
1 1 2
2 3 4
3 5 6
4 7 8 9
The following SQL:
SELECT Table1.ID, Table2.ID
FROM Table1 INNER JOIN Table2
ON (Table1.c = Table2.c)
AND (Table1.b = Table2.b)
AND (Table1.a = Table2.a);
Returns:
Table1.ID Table2.ID
4 4
I do want these tables connected by inner joins not left or right (in
other words I want only those records where all the joined fields are
equal to be returned). It seems that when the records contain
matching blank (null) fields that that is not considered a match.
How do I get the records with matching null fields to be returned with
the query?
I seem to have missed a fundamental concept about SQL. I would have
assumed that if two records contain nulls in joined fields that, given
all other fields are equal, they would match. Apparently not, so my
question is how do I force this behavior?
Thanks,
Tom