0

I have a table called industry table


id | name

1 IT

2 Banking

3 Telecom

I have another table called jobs table


id | job_title | industry

45 AsstManager 2,3

46 soft.dev 1,3


Now how do I search all the jobs in banking and telecom industry? I am using laravel5.4 query builder. I am really clueless, how can I approach this keeping in mind the performance also. Any help would be appreciated. Thanks

Joy
  • 301
  • 1
  • 5
  • 15
  • You've made a mistake by saving your relations as comma separated values. This is a huge headache. You should have used a mapping table for this many to many relationship. I would recommend you address that first. – Scopey Jun 12 '17 at 05:15
  • If you want to keep performance in the mind and also you would like to avoid using raw sql, then you need to change the design of your data structure not to use comma separated values in a single field. See this SO question for detsils: https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad – Shadow Jun 12 '17 at 05:15

0 Answers0