within my database table, i have a sector field that contains a comma separated list of sectors. each row pertains to a different employee so each sector set is going to be different. for example
employee | sectors
---------|--------
john |commercial
sam |commercial,education
bill |education,government
tom |government
sarah |commercial,utilities
-------------------------------
what im trying to do is formulate a mysql query expression that will return a list of employee names that contain a sector that is within a list i provide
let say my list of sectors is ['commercial', 'government'] and i want to query the database to return all employee names that have at least one of these sectors. so in this case i would get every employee name because the all have at least one sector that matches the two in my list, however if i change commercial to education within my list, the names i would then get would be sam, bill, tom.
if i was to do this in JS, it would look something along the lines of this.
var list = ['commercial', 'government']
for(var i=0; i<sectors.length, i++){
if(sectors[i] in list) {
return employee
}
}