MySQL Forums
Forum List  »  Newbie

need help with this SQL query
Posted by: Sarabjit Singh
Date: August 20, 2005 08:42AM

I have a table KEYWORDS, with 2 columns - personid, keyword

Lets say the user enters in the search field: Search by keywords - music indian chinese
What i need to do is this:
Return all 'personid' from KEYWORDS for each of which there exist 3 rows in the table, such that they have the same 'personid' and one keyword each from 'music', 'indian' and 'chinese' respectively.

Thus, 'personid' 1 and 3 will be returned for the following table:
personid, keyword
1, music
2, music
3, indian
4, chinese
1, chinese
3, music
1, indian
2, flute
1, drum
3, chinese
5, organ

What should be the corresponding SQL Select query?

Options: ReplyQuote


Subject
Written By
Posted
need help with this SQL query
August 20, 2005 08:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.