Anıl Özselgin
Anıl Özselgin

Reputation: 417

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

Is it possible to generate that SQL without hacking?

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

Upvotes: 1

Views: 340

Answers (1)

Aref Anafgeh
Aref Anafgeh

Reputation: 512

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)'));

Upvotes: 1

Related Questions