title: syntax for an "insert into... where not" in codeigniter
body: <p>I have a table with 4 fields: <code>field1</code>, <code>field2</code>, <code>field3</code>, <code>field4</code> and I want to insert registers that not exists if (<code>field1</code> and <code>field2</code> and <code>field3</code>) exists.</p>
  
  <p>My query is this :</p>
  
  <pre><code>INSERT INTO mytable (`id_est`, `id_course`, `date`,`nro`)
  VALUES ('5','7','2020-06-11','')
  where id_est and id_course
    and date not in (select id_est, id_course, date from mytable)
  </code></pre>
  
  <p>I want two things:</p>
  
  <ol>
  <li><p>Know Why with this query appears the next error:</p>
  
  <blockquote>
    <p>&#35;1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE &#96;id_est&#96; and &#96;id_course&#96; and &#96;DATE&#96; not in (select &#96;id_estudiante&#96;,' at line 1</p>
  </blockquote></li>
  <li><p>How can I transform this query according to the CodeIgniter syntax?</p>
  
  <pre><code>$data =array(
  )
  $this-&gt;db-&gt;insert('mytable', $data);
  $this-&gt;db-&gt;where_is_not();
  </code></pre></li>
  </ol>
  
  <p>Thanks.  The field <code>id_est</code> and <code>id_course</code> and <code>date</code> are key and I wan't that is repeated.</p>
  
  <p>Clarification:  I need to insert data in <code>mytable</code> with the next fields:  <code>id_est</code>, <code>id_course</code>, <code>date</code> and <code>nro</code>.  I need that <code>id_est</code> and <code>id_course</code> and <code>date</code> (all these three fields are unique), for example:</p>
  
  <pre><code>id_est         id_course          date           nro
  1                  1             date1            1
  1                  1             date2            3
  1                  1             date2            2 (this register is not insert because id_est=1 and id_course=1 and date2 is in my table)
  </code></pre>