Reputation: 24116
I have the following code to load a custom collection:
echo Mage::getModel("ibi/despatchqueues")
->getCollection()
->addFieldToFilter(
array(
'can_sync',
'is_synced'
),
array(
array('eq' => 1), // can_sync = 1
array('eq' => 0), // is_synced = 0
)
)
->getSelect();
This produces the following SQL Query:
SELECT `main_table`.* FROM `despatchqueues` AS `main_table`
WHERE (((can_sync = 1) or (is_synced = 0)))
How do I change my addFieldToFilter
so that the resulting query will look like this:
SELECT `main_table`.* FROM `despatchqueues` AS `main_table`
WHERE (((can_sync = 1) and (is_synced = 0)))
Upvotes: 1
Views: 2201
Reputation: 1062
try like this
echo Mage::getModel("ibi/despatchqueues")
->getCollection()
->addFieldToFilter('can_sync', array('eq' => 1))
->addFieldToFilter('is_synced', array('eq' => 0))
->getSelect();
Hope this helps!
Upvotes: 4