Let’s say my database value something like this
user_id question_id
---------------------
1 1,2,3,4,5
2 3,4,5
3 1,3,5
4 3,4,5,6,7
What is correct statement to find which user exactly using question_id 1 & 5
$query = '1,5';
question_id LIKE '%" . $query . "%'
FIND_IN_SET(question_id,'" . $query . "')
question_id IN ('" . $query . "')
I tried using LIKE, FIND_IN_SET & IN but the result is incorrect.
So I want the result should be
user_id question_id
---------------------
1 1,2,3,4,5
3 1,3,5
Let me know..
$query = ‘1,5’;
parse this into two variables
now create query dynamically