Hi
I have problem with Zend_Db_Select.
if i want do SQL like this:
Code:
SELECT DISTINCT `items`. * , `users`.`active` AS `useractive`
FROM `items`
LEFT JOIN `tagToItem` ON tagToItem.iid = items.id
LEFT JOIN `tags` ON tagToItem.tid = tags.id
WHERE (items.status =10)
AND
((items.name LIKE '%for%')OR (tags.name LIKE '%for%')OR (items.desc LIKE %for%'))
i must add this extra bracket before 'AND' like this:
PHP Code:
$items->select()
->distinct()
->from(array('items' => 'items'))
->where('items.status=?',CU_Enum_ItemStatus::ACTIVE)
->setIntegrityCheck(false)
->where('(items.name LIKE ?','%'.$word.'%') //here bracket before
->joinLeft('tagToItem','tagToItem.iid=items.id',array())
->joinLeft('tags','tagToItem.tid = tags.id',array())
->orWhere('tags.name LIKE ?','%'.$word.'%')
->orWhere('items.desc LIKE ?)','%'.$word.'%') //here bracket after
but i don't like this solution
did anyone have nice method to do bracets in SQL using Zend_Db_Select?