表一: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
表一: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
转载于:https://www.cnblogs.com/ziyandeyanhuo/p/11114683.html