Reputation: 2686
This is my query:
SELECT
store_id as `initial`,
CONCAT(',', store_id, ',') AS store_id
FROM `mytable` AS `main_table`
WHERE (`store_id` LIKE '%,13,%');
These are the results without the where
conditions:
When I executed my query , I got no results. Same for WHERE (
store_idLIKE '%,3,%');
Is it some kind of rule or exception for the ,
and like
operator ?
Thank you :)
Upvotes: 0
Views: 178
Reputation: 2686
Using FIND_IN_SET fixed my problem. More Info: https://www.w3resource.com/mysql/string-functions/mysql-find_in_set-function.php .
Credit goes to @Jens
SELECT
store_id as `store_id`,
FROM `ffm_nonpayment_actiontemplate` AS `main_table`
WHERE FIND_IN_SET('13', store_id);
Upvotes: 2
Reputation: 11
The problem is that field store_id
in WHERE has initial value and not the value you calculate with CONCAT(',', store_id, ',') AS store_id
If you want filter you can use HAVING
keyword
Upvotes: 0