I've been trying to solve this problem on and off for a couple of days now but am getting nowhere. Hopefully someone can help.
I have two tables where five columns match.
Table one has 10 columns and table 2 has just the five columns
I am trying to run a query where the result shows all the records in table two that do not exist in table 1. The problem is that I am trying to match all five fields from table 2 to table 1. I have run a query against table one to pick out the records with only the five fields I am trying to match as this reduces the number of records from 78,000+ to just over 4,000
I have tried the following sql but am getting a nil return:
SELECT DISTINCT .DATA_GRP_ID, .DATA_GRP_VER, .ACCESS_ID, .FUNCTION, .FUNCTION_QUAL
FROM [Pure Gold Paths Table] AS B
WHERE NOT EXISTS
(SELECT [All Access Control Table Query].DATA_GRP_ID, [All Access Control Table Query].DATA_GRP_VER, [All Access Control Table Query].ACCESS_ID, [All Access Control Table Query].FUNCTION, [All Access Control Table Query].FUNCTION_QUAL
FROM [All Access Control Table Query]
WHERE .DATA_GRP_ID = [All Access Control Table Query].DATA_GRP_ID
AND .DATA_GRP_VER = [All Access Control Table Query].DATA_GRP_VER
AND .ACCESS_ID = [All Access Control Table Query].ACCESS_ID
AND .FUNCTION = [All Access Control Table Query].FUNCTION
AND .FUNCTION_QUAL = [All Access Control Table Query].FUNCTION_QUAL);
The nested select seems to work and gives me (i think) the correct number of matches. The records that don't match should, therefore be the remainder and equals about 40 records.
I have two tables where five columns match.
Table one has 10 columns and table 2 has just the five columns
I am trying to run a query where the result shows all the records in table two that do not exist in table 1. The problem is that I am trying to match all five fields from table 2 to table 1. I have run a query against table one to pick out the records with only the five fields I am trying to match as this reduces the number of records from 78,000+ to just over 4,000
I have tried the following sql but am getting a nil return:
SELECT DISTINCT .DATA_GRP_ID, .DATA_GRP_VER, .ACCESS_ID, .FUNCTION, .FUNCTION_QUAL
FROM [Pure Gold Paths Table] AS B
WHERE NOT EXISTS
(SELECT [All Access Control Table Query].DATA_GRP_ID, [All Access Control Table Query].DATA_GRP_VER, [All Access Control Table Query].ACCESS_ID, [All Access Control Table Query].FUNCTION, [All Access Control Table Query].FUNCTION_QUAL
FROM [All Access Control Table Query]
WHERE .DATA_GRP_ID = [All Access Control Table Query].DATA_GRP_ID
AND .DATA_GRP_VER = [All Access Control Table Query].DATA_GRP_VER
AND .ACCESS_ID = [All Access Control Table Query].ACCESS_ID
AND .FUNCTION = [All Access Control Table Query].FUNCTION
AND .FUNCTION_QUAL = [All Access Control Table Query].FUNCTION_QUAL);
The nested select seems to work and gives me (i think) the correct number of matches. The records that don't match should, therefore be the remainder and equals about 40 records.