I have two tables called *tb\_student (id,name,age,sex)* and *tb\_course (id,namelist,title)*.

For example, *tb\_student* data is:

```
id  name   age sex
1   Tommy  11   1
2   Marry  11   0
3   Mike   11   1
4   Lucy   10   0

```

And *tb\_course* data is:

```
id  namelist    title
1   Tommy,Lucy  math
2   Marry,Tommy English

```

Now if I want to get the student who selected math, I could write the sql as:

```
select * from tb_student where 
FIND_IN_SET(name,(select namelist from tb_course where title='math'));

```

It is OK, it returns 'Tommy' and 'Lucy'.

But now if I have a student called `Tom` and he doesn't select math, my sql returns `Tom` as well. 

How to change my code? Do I need to define a function to loop the namelist?