hi i want create this sql in zend framework dbclass
selec * from table where type = 2 AND (name LIKE '%4%' OR name LIKE '%5%')
how i can do this with zend where and orwhere?
using normal mode will generate this sql
$this->select()->from($this->_name)->where('type = ?', $type)->orwhere('name LIKE ?', '%'.4.'%');
this is not what i need
also i think i can use having in this case , is this a good idea?
You want:
$this->select()
->from($this->_name)
->where('type = ?', $type)
->where('name LIKE ? OR name LIKE ?', array('%'.4.'%', '%'.5.'%');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With