Closed kamov closed 7 years ago
I have a query with different filter in where clausole. I would like to do something like below:
SELECT * FROM table WHERE status=1 AND (title LIKE '%test%' OR content='%test%') AND category_id=2
I have do like this:
$db->from('table') ->where('status', 1) ->where('title %', '%test%') ->where('|content', '%test%') ->where('category_id', 2) ;
But this return without parentesis, like below:
SELECT * FROM table WHERE status=1 AND title LIKE '%test%' OR content='%test%' AND category_id=2
Sparrow doesn't support complex queries like that. You would have to just pass your entire where clause as a string.
Thanks, work fine!
I have a query with different filter in where clausole. I would like to do something like below:
SELECT * FROM table WHERE status=1 AND (title LIKE '%test%' OR content='%test%') AND category_id=2
I have do like this:
$db->from('table') ->where('status', 1) ->where('title %', '%test%') ->where('|content', '%test%') ->where('category_id', 2) ;
But this return without parentesis, like below:
SELECT * FROM table WHERE status=1 AND title LIKE '%test%' OR content='%test%' AND category_id=2