title: mysql load data infile with 2 comparisons
body: <p>I have two tables each with a column called email_addr. Before a new record is inserted into the database, I need it to check for duplicates in each of these two tables first.</p>
  
  <pre><code>         CREATE TRIGGER del_chk AFTER DELETE ON list_no_email
           FOR EACH ROW
           BEGIN
                  INSERT INTO list_email(list_name, fname, lname, email_addr)
                  VALUES (?,?,?,?,?)
           END;//
           delimiter ;
           LOAD DATA INFILE $_FILES[''userfile']
           REPLACE INTO TABLE list_no_email
           FIELDS
                  TERMINATED BY ','
           LINES
                  TERMINATED BY '\n' (email_addr,id);
  
  
  
  
  +------------+--------------+------+-----+-------------------+-----------------------------+
  | Field      | Type         | Null | Key | Default           | Extra                       |
  +------------+--------------+------+-----+-------------------+-----------------------------+
  | id         | int(11)      | NO   | PRI | NULL              | auto_increment              |
  | date_in    | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
  | email_addr | varchar(150) | YES  |     | NULL              |                             |
  +------------+--------------+------+-----+-------------------+-----------------------------+
  3 rows in set (0.00 sec)
  </code></pre>
  
  <hr>
  
  <pre><code>mysql&gt; desc list_email;
  +------------+--------------+------+-----+---------+----------------+
  | Field      | Type         | Null | Key | Default | Extra          |
  +------------+--------------+------+-----+---------+----------------+
  | id         | int(11)      | NO   | PRI | NULL    | auto_increment |
  | list_name  | varchar(55)  | YES  |     | NULL    |                |
  | fname      | char(50)     | YES  |     | NULL    |                |
  | lname      | char(50)     | YES  |     | NULL    |                |
  | email_addr | varchar(150) | YES  |     | NULL    |                |
  +------------+--------------+------+-----+---------+----------------+
  5 rows in set (0.00 sec)
  </code></pre>