title: MySQL SELECT WHERE IN LIST and NOT IN LIST in the same SQL
body: <p>I have this:</p>
  
  <pre><code>    $ids = "1,2,3,4,5";
      $sqlQuery = "SELECT id, moderation_date
                      FROM table_live
                      WHERE id IN (".$ids.")";
  
      $q = $this-&gt;CI-&gt;db-&gt;query($sqlQuery);
  
      if($q-&gt;num_rows() &gt; 0) {
          foreach ($q-&gt;result() as $row) {
              $arr[] = $row;
          }
      }
  
      return $arr;
  </code></pre>
  
  <p>This is just working fine if all ids exist in table_live
  and return </p>
  
  <pre><code>           array([id] =&gt; 1 [moderation_date] =&gt; 2012-04-11 12:55:57)....
  </code></pre>
  
  <p>The problem: If I send a list of ids 1-2-3-4-5 where only 1-2-5 match the IN LIST clause
  I need to return all in list and for those don't match the list a null value.</p>
  
  <pre><code>           array([id] =&gt; 3 [moderation_date] =&gt; null) 
  </code></pre>