title: Mysql update if value doesn't exist
body: <p>I'm trying to write quite strange query and i'm having problem with <code>if</code> statement, so i have 2 fields <code>deleted_1</code> and <code>deleted_2</code> in my table which i wanna update, so this how i think it should be:</p>
  
  <pre><code>Update `messages`
    if(`deleted_1` == null) SET `deleted_1` = 1
    else
    if(`deleted_2` == null) SET `deleted_2 = 1
    ---and here goes some simple WHERE statements
  </code></pre>
  
  <p>but this doesn't work so basicly i wanna check if <code>a</code> field is empty then update it if not check <code>b</code> field and if it's empty update <code>b</code> field now i'm not sure maybe it's possible to do it in more simple way, i'm quite lost here :)</p>