FIND_IN_SET with two strings

前端 未结 3 691
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-27 15:21

I have this EMPLOYEE table of employees list

+-----+---------------+-------------+
| ID  |EMPLOYEE_ID    | SKILLS      |
+-----+---------------+-------------+
|          


        
相关标签:
3条回答
  • 2021-01-27 16:06

    You can try this over join

    DB::table('POSTED_JOB')->leftJoin('EMPLOYEE', function($join){
       $join->on(DB::raw("find_in_set(POSTED_JOB.JOB_SKILLSmEMPLOYEE.SKILLS)"));
    });
    
    0 讨论(0)
  • 2021-01-27 16:11

    You can try this to search in two columns.

    SELECT * FROM order1 WHERE FIND_IN_SET(order_no,'$foo') OR awb_no IN ('$foo')
    
    0 讨论(0)
  • 2021-01-27 16:15
    $skills = 'select the employee skills';
    $skl_arr = explode(',',$skills);
    $skl_length = count($skl_arr); 
    

    /*query */

    $rows->orwhere(DB::raw("find_in_set('$skl_arr[0]','post_job.skills')"));
    
    for ($i=1; $i < $skl_length ; $i++) { 
                    $rows->$join->on(DB::raw("find_in_set('$skl_arr[$i]','post_job.skills')",DB::raw(''),DB::raw('')));
    
    }
    
    0 讨论(0)
提交回复
热议问题