I have table Inbound with ~2mil records, with the following structure
    Inbound table
    ID   campaign_id   Entry_status  Error_code     
    A1      1234            0            0
    B1      1234           -1           -1
    C1      4123            0           -15
    C1      4123            0            0
I also have a table Rules which is the list of all the combinations of Entry_status and Error_code which denote a valid entry in the Inbound table
    Rules table
    campaign_id   Entry_status  Error_code    
       1234            0            0
       4123            0           -15
I am trying to create a query which will allow my to list all the entries in      Inbound   which are valid based on the combinations      Entry_status & Error_code in Rules
So far I have come up with this, but it is only giving me the invalid entries, and I also suspect it to be wrong.
SELECT * FROM Inbound
  WHERE ID not IN (
         SELECT ID FROM Inbound JOIN Rules
         on Inbound.campaign_id= Rules.campaign_id
         where Inbound.Entry_status = Rules.ENTRY_STATUS 
          and 
          Inbound.Error_code = Rules.Error_code
 )  
It feels like I need to nest another query to take account of the combination of the 2 columns to produce a valid entry?
Had a look at this and this but not help as the validation criteria is a string, rather than a combination of columns
................................
Bonus
Is it possible to add true / false field in ìnbound which denotes if the records are valid based on the rule combination in rules
Can I run
      Update Inbound I
      SET I.valid = if(**select function** = True , 1 ,0 )
so Inbound has the valid and invalid entries flagged, rather than just another table
Select function courtesy of underscore-d
select distinct Inbound.*
from Inbound
inner join Rules on
Inbound.campaign_id = Rules.campaign_id
Where 
Inbound.Entry_status = Rules.Entry_status and
Inbound.Error_code = Rules.Error_code;`
 
     
    