I have a table with two fields candidate_id and keyword_id. I needs to list all the candidates/candidate_id having keyword_id 5 and 6. Somebody please help me to write a single mysql query for this please.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
An option that is simple to adapt to more than just two keyword_id’s would be…
An alternative could be…
It should be noted, however, that neither of these options scales very well (as you increase the number of candidates, keywords, and number of keywords that you search for.
How to deal with this poor scaling totally depends on your data, and your needs. It’s too broad and subjective a topic to discuss in a SO answer.