search query to compare a particular word from a string to values of another string in mysql -


i making search module in require search details of users matching details of other user need compare user details . details age, gender etc have used like '%search_term%' , able results wanted not able make query details user 1 speaks english,french,spanish stored in database words seperated comma same markup. , suppose other user have 1 language in common latin,hindi,french ie french in common how filter user according user 1's details such he/she still have in common. following query normal values such age

select * users_profile  age '%$search_term%'  order created_time desc 

how make query within 1 using and , results?

you can self join , replace commas in 1 of them pipes , use regular expression rlike. performance horrible.

select users_profile.*, users_profile2.id other_id,    users_profile2.language other_lang users_profile   inner join users_profile users_profile2 on     users_profile.language rlike        replace(users_profile2.language,",","|")      , users_profile.id != users_profile2.id; 

you can see yourself: http://sqlfiddle.com/#!2/9549f/6


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -