Question: I am working on SQL Server and I have two tables TableMaster and TableValidator. They both share 5 columns but no IDs. I need to find in TableValidator all those records that are not on the TableMaster to eventually insert them into TableMaster. If the values of all those 5 columns are identical on both then that is the same record.

For example:

TableMaster

```
 JobCode | Location | Code1 | Code2 | Code3 | Other column...
>100333    USA        A112    TR      0057
 100987    TAR        A112    TR      0098
>220999    PUR        R100    LK      0098
...

```

TableValidator

```
 JobCode | Location | Code1 | Code2 | Code3 | Other column...
 100333    USA        A100    NS      0057
 100987    TAR        A112    TR      0098
>220999    PUR        R100    LK      0098
 220999    PUR        R100    LK      1009
 220999    PUR        R100    LK      3305
>100333    USA        A112    TR      0057
...

```

As you can see in this tables only two records are identical. I need to identify those on TableValidator that are not on the TableMaster in order to insert them back into TableMaster.

Answer: 
You can simply use `NOT EXISTS()` as

```
INSERT INTO MasterTable (JobCode, Location, Code1, Code2, Code3)
SELECT JobCode, Location, Code1, Code2, Code3
FROM ValidatorTable VT
WHERE NOT EXISTS(
                  SELECT 1
                  FROM MasterTable MT
                  WHERE VT.JobCode = MT.JobCode 
                        AND VT.Location = MT.Location
                        AND VT.Code1 = MT.Code1
                        AND VT.Code2 = MT.Code2 
                        AND VT.Code3 = MT.Code3
                );

```

Here is a `[db-fiddle](https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=cd10b487e1916af8a0ae344ff5a699c0)`
Try the below?

```
Select A.JobCode From TableValidator A
Left join TableMaster B on A.JobCode = B.JobCode
Where B.JobCode is null

--OR

Select A.JobCode From TableValidator A
Where not Exists(Select 1 From TableMaster B where A.JobCode = B.JobCode)

```