1

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 Answer 1

1

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)'));
Sign up to request clarification or add additional context in comments.

4 Comments

Still it seems like a hacky solution.
Exec also solves my problem. I want to find a proper way. I was trying to find a more structured way like we do in selects.
first of all if this solved your problem then you sholud accept my answer..second,this methods create a query in zend db table or zend_db_table_abstract libraries....you can take a look at them to underestand the system
Thanks for your answer. But in the question i asked for a solution "without hacking". Maybe I was not clear enough. I was trying to find a solution like andX and orX of doctrine. Please check this solution for doctrine stackoverflow.com/questions/9815047/… I'll accept your solution. Thanks for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.