表一: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

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。