Hi All,
I've tried to get the records of the a field (SN) from table A that exists in the field (OT) or field (IN) of table B and use not exists as well but the problem i face here is that when i use the sql query in access i get my both results but when query is used with excel i get the correct results only in the EXISTS statement but no records was found in NOT EXISTS statement
here's the sql statement used in Access
In the access it is find but with excelCode:"SELECT * FROM [SCETRETURN] AS S WHERE EXISTS (SELECT * FROM CLAIM AS C WHERE (C.OT=S.SN OR C.IN=S.SN)) /*HERE I GET 9 records out of 10 records "SELECT * FROM [SCETRETURN] AS S WHERE NOT EXISTS (SELECT * FROM CLAIM AS C WHERE (C.OT=S.SN OR C.IN=S.SN)) /*HERE I GET 1 records out of 10 records
Code:"SELECT * FROM [SCETRETURN$] AS S WHERE EXISTS (SELECT * FROM [CLAIM$] AS C WHERE (C.OT=S.SN OR C.IN=S.SN)) /*HERE I GET 9 records out of 10 records "SELECT * FROM [SCETRETURN$] AS S WHERE NOT EXISTS (SELECT * FROM [CLAIM$] AS C WHERE (C.OT=S.SN OR C.IN=S.SN)) /*HERE I GET 0 records out of 10 records
That's strange as the query are the same but the results for NOT EXISTS ain't the same.
OUT OF 10 RECORDS - ACCESS - EXCEL
EXISTS STATEMENT - 9 - 9
NOT EXISTS STATEMENT - 1 - 0
Could anyone please help?
Regards,
Joey


Reply With Quote


Bookmarks