Zend Db Library: How to delete multiple rows with different contraints?

336 Views Asked by At

Is it possible to generate that SQL without hacking?

DELETE FROM product WHERE (type=1 AND deleted=1) OR (type=2 AND category=10);
1

There are 1 best solutions below

4
Aref Anafgeh On BEST ANSWER

use this sample:

$db->delete(array('(type=1 AND deleted=1) OR (type=2 AND category=10)'));

or if you have a model class for each table so:

$model = new Product();
$model->delete(array('(type=1 AND deleted=1) OR (type=2 AND category=10)'));