• Add an additional unique constraint to the other tables with (tablenameID, CompanyID), then add CompanyId to table EarningsMiscWrk, and then create the FK references to be (tablenameID, CompanyID), instead of just tablenameID.

    Then all references can only be for the particular CompanyID in the EarningsMiscWrk row.