![]() |
POSITION(substr IN str) mysql problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: POSITION(substr IN str) mysql problem (/showthread.php?tid=25738) |
POSITION(substr IN str) mysql problem - El Forum - 12-22-2009 [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 --> it still returns <>0 (in logic it is RIGHT) BUT I want it search exactly the ID in list 12,451,21, --> 451 is OK, NOT 51 Can anybody help me? Thank you a lot. I'm sorry for my poor English POSITION(substr IN str) mysql problem - El Forum - 12-23-2009 [eluser]saidai jagan[/eluser] u can use SELECT FIND_IN_SET('b','a,b,c,d'); |