SELECT A.staff_id,B.staff_name FROM (SELECT info_id,staff_id, IF(course LIKE '%1%',1,0) AS course1, IF(course LIKE '%2%',1,0) AS course2, IF(course LIKE '%3%',1,0) AS course3 FROM cultivate_tb WHERE course IS NOT NULL)A JOIN staff_tb B ON A.staff_id=B.staff_id WHERE A.course3=1