mardi 29 décembre 2015

FIND_IN_SET with two strings

I have this EMPLOYEE table of employees list

+-----+---------------+-------------+
| ID  |EMPLOYEE_ID    | SKILLS      |
+-----+---------------+-------------+
|  1  |       1       |   3,4       |
+-----+---------------+-------------+
|  2  |       2       |   3,5,2     |
+-----+---------------+-------------+
|  3  |       3       |  1,5        |
+-----+---------------+-------------+

and table POSTED_JOB listing jobs

+-----+---------------+-------------+
| ID  |POSTED_JOB_ID  |  JOB_SKILLS |
+-----+---------------+-------------+
|  1  |       1       |   1,2,3     |
+-----+---------------+-------------+
|  2  |       2       |   3,4       |
+-----+---------------+-------------+
|  3  |       3       |   5,4       |
+-----+---------------+-------------+
|  4  |       4       |   5,6       |
+-----+---------------+-------------+

How can I get all jobs posted with skills corresponding to the skills of employees with laravel query.

For example for employee with employee_id 1, the jobs would be 1,2, and 3.

I tried with find_in_set but here both are lists. DB::raw("find_in_set(EMPLOYEE.SKILLS , POSTED_JOB.JOB_SKILLS)"), DB::raw(''), DB::raw(''))



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire