To shorten the long story: is it possible, and if so - how can I create a query that looks somewhat similar to this
SELECT * FROM a
WHERE row = 1 AND
(other_row LIKE '%..%' OR another_row LIKE '%..%')
Basically, I cannot find a solution to this problem. I just can't figure out how to add parentheses to an activerecords request. Is it possible?
My current code is:
$data = $this->where('row', 1)
->like('another_row', '...')
->or_where('row', 1)
->like('other_row', $search)
->get('a')
->result();
Result:
SELECT * FROM (`a`) WHERE `row` = 1 OR `row` = 1 AND `another_row` LIKE '%...%' AND other_row` LIKE '%...%'
source
share