Answer the question
In order to leave comments, you need to log in
Creating a SQL query with a complex LIKE condition?
There is a cell users with values (1,2,3,4,5,6...). From the user I get a number and I need to select the emails of everyone who has this number in this cell. Help me compose the correct SQL query.
Answer the question
In order to leave comments, you need to log in
Anything like this?
SELECT *
FROM `table`
WHERE `users` REGEXP '([^0-9]{$user}[^0-9])'
SELECT *
FROM `table`
WHERE `users` LIKE '{$user},%' OR `users` LIKE '%,{$user},%' OR `users` LIKE '%,{$user}'
If I understand the problem correctly:
SELECT email FROM `users` WHERE FIND_IN_SET(1, usergroups)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question