JOIN is what you need. http://www.mysql.com/doc/J/O/JOIN.html
Some examples: mysql> SELECT * FROM table1,table2 WHERE table1.id=table2.id; mysql> SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id; mysql> SELECT * FROM table1 LEFT JOIN table2 USING (id); mysql> SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id -> LEFT JOIN table3 ON table2.id=table3.id; mysql> SELECT * FROM table1 USE INDEX (key1,key2) -> WHERE key1=1 AND key2=2 AND key3=3; mysql> SELECT * FROM table1 IGNORE INDEX (key3) -> WHERE key1=1 AND key2=2 AND key3=3; Mike T.Thiessens wrote: > Well..complex..for me at least! > > I have a table containing story's > All storys have one unique `storyID` > I have another table where I keep track of user's favorite story's. > This table has two columns `clientID`and `storyID` > after a while, you could end up having the following rows in favorite > documents > `clientID` `storyID` > 1 5 > 1 19 > 1 6 > 1 2 > 2 3 > 2 19 > 3 88 > f.e. if you select from the `library' story 19, you get the content, the > author, the date etc... > if you select from clients, client 2, you'll get all the client's > information. > > But!! > I want to select all the story's from favorite documents where `clientID` = > 1; > In this, I get the content, the author, etc..etc from storyID 5, 19, 6 and 2 > (the above example) > Do you understand all this? Or is it big blurry thing? > > I could send you print out's from my database... > > Thank in advance!!! > > Thijs Thiessens > (mySQL is gooood!!) > > > > > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php