Well, if both tables are in the same database: select * from books inner join publishers on books.publisherid = publishers.publisherid
this assumes that the key for the publisher is publisherid and that publisherid also appears in the book table. This gives you a result set that contains the appropriate information from both tables merged. Marco ----------- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Wed, 6 Nov 2002, Edgard Berendsen wrote: > I know this can be a little out of topic but: > > I have a books database and each book belongs to a publisher. > There is also a publisher database with information like (name, > location, etc). In the books database there is a key to identify the > publisher. > > I need a mySQL query for showing each book with each publisher > name and location. > > I don't want to do it using nested loops in .php because I think that > using a "master" SQL query that can access both tables (all inside mySQL) > and their relations can be much faster. > > Thanks > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php