I have a user table in which we store skills of a user that is a comma separated ids like ,These are primary key of skill table
'2,3,4,5'
and i have a search page,In which we have to search using the skills that also multiple entry, the data is like this
'2,3' or '3,4' or '6,7' or '2'
my question is how do i write the where
clause any one please help thanks in advance
This is too long for a comment.
Your database structure should be fixed. You need a junction table, called something like UserSkills
, with one row per user and per id.
Here are some reasons:
All though this is not the right way to store forign keys in the dabase. However, per your problem, you might want to do something like this.
SELECT * FROM tbl_user WHERE skill LIKE '%2, 3%';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.