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,
Martin Rytz wrote:
[...]
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)?
SELECT animal,pic
FROM animal_pic,animal,pic
WHERE
animal.id = animalid AND
pic.id = picid
This will list all animals which have pictures,
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