Hi All
I am running into a strange situation here within my query built in Access.
The query INNER JOIN 2 other queries ( there are only 3 identical fields in each query: Account, Buy, Sell) to track the difference of Buy and Sell (populated with numbers or blank) between the 2 queries.
Understood that Null is not equal to Null in Access, therefore I used NZ function to force all the blanks into number '0'.
However, it worked on most of the records (group A) but did not work some other records (group B).
What was strange was that, If I did not use NZ function at all, then the result would flip: it worked on group B but not on group A.
I double checked the data type, for both queries (they both ran on tables linked to Excel spread sheets), Buy and Sell was either populated with number or blank (no space)
Here is the query,
Can anybody see what's wrong here, thanks!
I am running into a strange situation here within my query built in Access.
The query INNER JOIN 2 other queries ( there are only 3 identical fields in each query: Account, Buy, Sell) to track the difference of Buy and Sell (populated with numbers or blank) between the 2 queries.
Understood that Null is not equal to Null in Access, therefore I used NZ function to force all the blanks into number '0'.
However, it worked on most of the records (group A) but did not work some other records (group B).
What was strange was that, If I did not use NZ function at all, then the result would flip: it worked on group B but not on group A.
I double checked the data type, for both queries (they both ran on tables linked to Excel spread sheets), Buy and Sell was either populated with number or blank (no space)
Here is the query,
Code:
SELECT TblA.Account, TblA.Buy, TblA.Sell, TblB.Buy, TblB.Sell
FROM TblA INNER JOIN TblB
ON TblA.Account = TblB.Account
WHERE NZ(TblA.Buy,0) <> NZ(TblB.Buy,0) or NZ(TblA.Sell,0) <> NZ(TblB.Sell,0);
Can anybody see what's wrong here, thanks!