Strange problems with a join
Posted: Wed Nov 19, 2008 11:17 pm
So I have three records in my database, but when I run this query, it returns 9 results, three instances of each record. Why?
SELECT fileName, title, author, category FROM photos AS p, authors AS auth, categories AS cat, photo_associations AS pa WHERE pa.cat_id = cat.cat_id AND pa.author_id = auth.author_id ORDER BY p.photo_id;
SELECT fileName, title, author, category FROM photos AS p, authors AS auth, categories AS cat, photo_associations AS pa WHERE pa.cat_id = cat.cat_id AND pa.author_id = auth.author_id ORDER BY p.photo_id;