Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • FIND_IN_SET() Function in MySql

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 245
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: