try this:
SELECT *
FROM `users`
WHERE user = 'king'
OR alias = 'king'
OR FIND_IN_SET ('king', aliases)>0;
Domanda
I need to search a column for a string ,multiple times for variation of the same string, so i did this
SELECT *
FROM `users`
WHERE user = 'king'
OR alias = 'king'
OR aliases LIKE '%,king%'
OR aliases LIKE '%king,%'
OR aliases LIKE '%king,%'
the column aliases
will contains words separated with comma e.g king,queen,knight
etc
But because like itself is slow, i am wondering if there is any way i can optimize this query
Soluzione
try this:
SELECT *
FROM `users`
WHERE user = 'king'
OR alias = 'king'
OR FIND_IN_SET ('king', aliases)>0;