Welcome Guest, Not a member yet? Register   Sign In
POSITION(substr IN str) mysql problem
#1

[eluser]satanrulehis[/eluser]
I have a table has a field list_categoty with the value separate by coma : 12,451,21, . Now I want to search if an ID in that string. In my SQL I use
Code:
POSITION(ID  IN list_categoty) <>0
.
The problem I have is if the input =51 --&gt; it still returns <>0 (in logic it is RIGHT) BUT I want it search exactly the ID in list 12,451,21, --&gt; 451 is OK, NOT 51

Can anybody help me?
Thank you a lot.
I'm sorry for my poor English
#2

[eluser]saidai jagan[/eluser]
u can use SELECT FIND_IN_SET('b','a,b,c,d');




Theme © iAndrew 2016 - Forum software by © MyBB