In MS Access database to find the mismatch (i.e. difference) records between two tables(Employee and Employee_PROD) I am using the UNION ALL. The query is as follows:
SELECT [COMPANY],[DEPT],[DOJ],[EMP_ID],[Name],[SUB_COMPANY] FROM
(SELECT '[Employee]' AS TableName,[COMPANY],[DEPT],[DOJ],[EMP_ID],[Name],[SUB_COMPANY] FROM [Employee]
UNION ALL
SELECT '[Employee_PROD]' AS TableName,[COMPANY],[DEPT],[DOJ],[EMP_ID],[Name],[SUB_COMPANY] FROM [Employee_PROD] )
GROUP BY [COMPANY],[DEPT],[DOJ],[EMP_ID],[Name],[SUB_COMPANY]
HAVING COUNT(*) = 1 AND MIN(TableName) = '[Employee]'
The problem I am facing is that the GROUP BY
is not considering the case sensitivity. For example "andrew" and "Andrew" is treated as same. I want to perform group by with case sensitive to find the difference records.
Is there any way to do the same in MS Access?
Is there any other approach to find the differences between two tables having same column names, data types and the number of records is 7,00, 000?
I have tried the following:
- Load data to
DataTable
and then find the difference. Got out of memory exception due to huge amount of data. - Use
NOT EXISTS
to compare the rows. The query got hanged and the execution never completed. - The
UNION ALL
approach is working but the issue is thatGROUP BY
is not considering the case sensitivity.