表一:login

id cids state
1 1,2 1

表二:learn

id name
1 zhangsan
2 lisi
3 wangwu

 

select g.id, GROUP_CONCAT(s.name) as sname from login g left join tlearn s on FIND_IN_SET(s.id, g.cids) GROUP BY g.id

  mysql 一表字段逗号分隔对应另一表字段查询