Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Use of Find in set() function in mysql

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 113
    Comment on it

    In some cases, we use find_in_set() instead of in() in mysql. Following is an example, where we should use find_in_set() instead of in() :-

    Suppose we have a table 'flashdata':-

    fid     productId
      1              75,73
      2              72
      3              71, 73

    Now, if we want to get all fid that have productId is 73 then our query should be:-

    select fid from flashdata where find_in_set(73, productId);

    it returns fid 1 and 3

 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: