title: Exclude ids in SQL or in the script
body: <p>I'm need to exclude some rows by id from SQL query results, but which way will be better to do this? </p>
  
  <p>Using NOT IN by primary key <code>id</code>:</p>
  
  <pre><code>SELECT id, key1, key2 FROM my_table WHERE id NOT IN (#EXCLUDE_IDS)
  </code></pre>
  
  <p>Or in the post-processed loop after query in the script:</p>
  
  <pre><code> foreach ($rows as $i =&gt; $row) {
      if (isset($exclude[$row['id']])) {
        unset($rows[$i]);
      }
   }
  
   # or
   for ($i = count($rows) - 1; $i &gt;= 0; $i--) {
      if (isset($exclude[$rows[$i]['id']])) {
        unset($rows[$i]);
      }
   }
  </code></pre>