Here I am trying shewing list sorting base in same language and hobbies the users with same language and hobbies numbers
var user_id = req.body.user_id;
/*var sql = 'SELECT *
FROM `tbl_user`
WHERE `user_hobbies` =?
OR `user_language_id` = ?
ORDER BY `user_id` DESC';*/
var sql ='SELECT
DISTINCTROW IF((pic.alloweduser_id > 0),\'1\',\'0\') AS pAccess,
usr.user_id AS userid,
usr.user_name AS name,
usr.user_gender AS gender,
usr.user_profile_pic AS profile_pic
FROM tbl_user usr
LEFT JOIN tbl_profilepic pic
ON pic.alloweduser_id = usr.user_id
WHERE
`user_hobbies` LIKE CONCAT(\'%\',(
SELECT `user_hobbies`
FROM tbl_user
WHERE user_id = ?), \'%\')
AND usr.`user_language_id` IN (
SELECT `user_language_id`
FROM tbl_user)
AND usr.user_id != ?
ORDER BY usr.`user_name` ASC';
connection.query(sql,
I do not know what I am doing wrong , it is only working with hobbies but language still shewing users from different language
Update
- user2 : language (1) - Hobbies (1,2,3,4)
i am trying to show users with same language (1) than users share the 4 hobbies .if not 3 hobbies ..if not 2 hobbies .. if not 1 hobbie

user_hobbiesentry look like for a user with multiple hobbies? It feels like it's trying to cram a one-to-many relationship into a single cell.user_hobbiesmight be better done as a join table.