Its an SQL question.
Im trying to embed SQL statement on my VBA.
I have the following tables
Table1 with Fields (Field1, Field2, Field3, Field4)
and
Table2 with Fields (Field1, Field2, Field5, Field6)
Their common fields are Field1 and Field2
I want to join these two tables based from the WHERE conditions of Table1
But whenever I tried to use INNER JOIN, they get different record counts.
This is the correct record counts
RECORD COUNT is 68:
When I try to use INNER JOIN
RECORD COUNT is only 4
Note: the record count 4 are the 4 records on TABLE2
What seems to be the problem.
I need to get the 68 records from TABLE1 with the added fields from TABLE2
Please help..
Im trying to embed SQL statement on my VBA.
I have the following tables
Table1 with Fields (Field1, Field2, Field3, Field4)
and
Table2 with Fields (Field1, Field2, Field5, Field6)
Their common fields are Field1 and Field2
I want to join these two tables based from the WHERE conditions of Table1
But whenever I tried to use INNER JOIN, they get different record counts.
This is the correct record counts
RECORD COUNT is 68:
Code:
SELECT COUNT(*) FROM TABLE1 A
WHERE A.Field1='2015/07/15' And A.Field2>'9999999'
When I try to use INNER JOIN
RECORD COUNT is only 4
Note: the record count 4 are the 4 records on TABLE2
Code:
SELECT COUNT(*) FROM TABLE1 A
[COLOR=#ff0000] INNER JOIN TABLE2 B
ON A.Field1=B.Field1 AND A.Field2=B.Field2[/COLOR]
WHERE A.Field1='2015/07/15' And A.Field2>'9999999'
What seems to be the problem.
I need to get the 68 records from TABLE1 with the added fields from TABLE2
Please help..