SQL Query IN and NOT IN

Magento uses keywords in for IN and nin for NOT IN

...
 
$productIds = array(1251,1253,1256);
 
if ($column->getFilter()->getValue()) {
      $this->getCollection()->addFieldToFilter('entity_id', array('in'=>$productIds));
}
      else {
     $this->getCollection()->addFieldToFilter('entity_id', array('nin'=>$productIds));
}
...

Leave a Reply