SELECT animal, pic from animal AS a, pic as p, animal_pic as ap WHERE animal = 'penguin' AND ap.animalid = a.id and ap.picid = p.id
On Wed, 2005-02-16 at 03:32, Martin Rytz wrote: > Hi SQL-Community > > I need once more your help, I have a tricky problem with my animal-db. > > I have a table with animals and a table with animal-pics. I have a third > table. In this table you can see, which pic belongs to which animal: > > CREATE TABLE animal ( > id int(11) NOT NULL auto_increment, > animal varchar(250) NULL, > PRIMARY KEY (id) > ); > CREATE TABLE pic ( > id int(11) NOT NULL auto_increment, > pic varchar(250) NULL, > PRIMARY KEY (id) > ); > CREATE TABLE animal_pic ( > animalid int(11) NULL , > picid int(11) NULL > ); > > The problem is now, that there can be n pics for an animal! > > With which join can I show the animals with all pics for this animal (even > if there are more than one pic for an animal)? > > Thank you for you ideas! > > Martin -- - michael dykman - [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]