I have join statements with WHERE
and multiple OR WHERE
with LIKE
, below is what I've tried and unfortunately it's not working like even with invalid LIKE
value e.g. LIKE %0000%
and I'm sure there's no such relevant data on the given like query but still the sql below returns rows. Any help, ideas is greatly appreciated.
SELECT `a`.`id`, `a`.`subcategory_id`, `a`.`ps_id`, `b`.`id` AS `b_id`, `b`.`ps_keyword`, `b`.`created_at`
FROM `buss_subcategory_products_services` `a`
LEFT JOIN `buss_products_services` `b` ON `b`.`id` = `a`.`ps_id`
WHERE `b`.`is_deleted` =0
AND `a`.`subcategory_id` = '11'
OR (
`a`.`subcategory_id` = '1'
OR `a`.`subcategory_id` = '8'
OR `a`.`subcategory_id` = '5'
OR `a`.`subcategory_id` = '2'
OR `a`.`subcategory_id` = '3'
OR `a`.`subcategory_id` = '9'
OR `a`.`subcategory_id` = '4'
OR `a`.`subcategory_id` = '10'
OR `a`.`subcategory_id` = '6'
OR `a`.`subcategory_id` = '7'
)
AND `b`.`ps_keyword` LIKE '%xxxxxxxxxxxxxxxxxxxxxxxxxxxx%' ESCAPE '!'
ORDER BY `b`.`ps_keyword` ASC