student表的courses字段,存着course的id,现在需要学生的所有课程用字符串的形式查出
student表
| id | name | courses |
| 1 | 小明 | 44,55,66 |
| 2 | 小红 | 11 |
| 3 | 小紫 | 22,44 |
course表
| id | name |
| 11 | 数学 |
| 22 | 语文 |
| 66 | 英语 |
| 44 | 体育 |
| 55 | 美术 |
查询sql
select a.*,to_char(wm_concat(b.name)) from student a,course b where instr(b.id, a.courses ) > 0