I used the search function which brought me to the following solution.
Starting Point is the following: I have one table A which stores all data. From that table I select a certain amount of records and store it in table B.
In a new statement I want to select new records from table A that do not appear in table B and store them in table c. I tried to solve this with a AND ... NOT IN statement. But I still receive records in table C that are in table B.
Important: I can only work with select statements, each statement needs to start with select as well. Does anybody have an idea where the problem in the following statement could be:
Select *
From
(Select TOP 10000 *
FROM [table_A]
WHERE Email like '%@domain_A%'
AND Id NOT IN (SELECT Id
FROM [table_B]))
Union
(Select TOP 7500 *
FROM table_A]
WHERE Email like '%@domain_B%'
AND Id NOT IN (SELECT Id
FROM [table_B]))
Union
(SELECT TOP 5000 *
FROM [table_A]
WHERE Email like '%@domain_C%'
AND Id NOT IN (SELECT Id
FROM [table_B]))