[nycphp-talk] What's the best way query a table with a "one-to-many"relationship? Suggestions???
Henry Ponce
henry at beewh.com
Mon Jul 5 08:37:56 EDT 2004
To get all the product information with the ALL the thumbnails for each
product:
select * from products p inner join photos f on (p.id = f.id_product)
If you want the Main thumbnail then you can add the where clause. You can add
p.id=some_id to the where clause to get the result for a certain product.
I hope this helps.
Henry
More information about the talk
mailing list