find_in_set() is a function which returns the position of a string within second string.
We mostly found a situation where we want to fetch records on the basis of particular string and that string are stored in comma separated values in database field column. In my case I have to pull all the records whose status match with status list separated with comma are stored in table.
Syntax are :
FIND_IN_SET(arg1,arg2)
arg1 is a string
arg2 is a string with commas separated
Below is the syntax for fetching the match records on the basis of id.it will find all the records by matching the id
select * from tablename where find_in_set(id,id_path);
where id_path is a field which contains values separated with commas.
0 Comment(s)