我使用codeigniter活动记录类编写了一个查询。
编写查询时,它看起来像
WHERE `account` = 1
AND cgl.contactId IS NULL
AND `firstName` LIKE 'M%'
OR `lastName` LIKE 'M%'
但我需要它看起来像
WHERE `account` = 1
AND cgl.contactId IS NULL
AND (`firstName` LIKE 'M%'
OR `lastName` LIKE 'M%') //notice the brackets
我该怎么做?
答案 0 :(得分:0)
$this->where(array('account' => 1, 'cgl.contactId' => NULL);
$this->where(("firstName` LIKE 'M%' OR `lastName` LIKE 'M%'"))