[eluser]emurad[/eluser]
Hello guys,
An active record is generating the following:
Code:
SELECT `items`.*, (select users.username from users where users.id = items.user_id) as username,
`categories`.`title` as cat_title, `categories`.`friendly_id` as cat_friendly_id FROM (`items`)
JOIN `categories` ON `categories`.`id` = `items`.`category_id` WHERE `items`.`type` = 'books'
AND `items`.`category_id` = '11' AND `items`.`status` = 1 AND `items`.`title` LIKE '%www%'
OR `items`.`author` LIKE '%www%' OR `items`.`description` LIKE '%www%'
OR `items`.`content` LIKE '%www%' OR `items`.`additional` LIKE '%www%'
ORDER BY `items`.`id` DESC LIMIT 10
I need it as follow:
Code:
SELECT `items`.*, (select users.username from users where users.id = items.user_id) as username,
`categories`.`title` as cat_title, `categories`.`friendly_id` as cat_friendly_id FROM (`items`)
JOIN `categories` ON `categories`.`id` = `items`.`category_id` WHERE `items`.`type` = 'books'
AND `items`.`category_id` = '11' AND `items`.`status` = 1 AND ******(******`items`.`title` LIKE '%www%'
OR `items`.`author` LIKE '%www%' OR `items`.`description` LIKE '%www%'
OR `items`.`content` LIKE '%www%' OR `items`.`additional` LIKE '%www%'******)******
ORDER BY `items`.`id` DESC LIMIT 10
Note the brakets emphasized by the 6 asterisks. Of course I just want to add the brakets not the asterisks.
Thanks.