Table A
id name
1 name1
2 name2
3 name3
4 name4
Table B
id userlist
1 1,2,3,4
What I do now is
SELECT `userlist` FROM `table B` WHERE `id` = 1
Then save the result and put into second query
SELECT `name` FROM `table A` WHERE `id` in ($userlist)
Just wondering if got better way. I try
SELECT `name` FROM `table A` WHERE `id` in (SELECT `userlist` FROM `table B` WHERE `table B`.`id` = 1)
But it only return 1 result.
EDIT*
DB structure can not be change since so many data inside. I just try to optimize the old code.