Hi,

I have three tables, a title's table, a genre's table and a genre_titles map
table (to model the many to many relationship between genre's and title's).

I need to write a query that will return title's that match two or more
genre's. An example would be one title could be a comedy/drama and I would
need to find other title's that have a reference to the genre's comedy and
drama. I have tried this query -

"select titles.name, genre_titles.titleid from titles, genre_titles
 where genre_titles.genid = 4 and genre_titles.titleid = titles.titleid
 or genre_titles.genid = 5 and genre_titles.titleid = titles.titleid"

with programmatic sorting but the result sets are too large and the sorting
algorithm is too slow. I was wondering whether there was a query that would
return the exact result set needed. I am using mysql 4.0.13


Regards
AndyB


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to