title: MYSQL trigger see if record exists first?
body: <p>So I have a trigger that works on update. Totally works fine.</p>
  
  <p>Insert in cars(date, id, parent_id) values (date, ford, 2)</p>
  
  <p>What I need to do is to actually check to see if the parent_id already exists. If it does do nothing but if it does not exist then do the insert statement.</p>
  
  <p>right now i have</p>
  
  <pre><code>SET @myVar1 = (SELECT parent_id from cars where parent_id = NEW.id);
  IF @myVar1 = NULL;
  Insert in cars(date, id, parent_id) values (date, ford, 2);
  ENDIF;
  </code></pre>
  
  <p>I keep getting sysntax error. How am I writing this worng?</p>