[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 09:55:31 EDT 2004
Note: this will retrieve only those products that have thumbnails.
Henry
On Monday 05 July 2004 09:37, Henry Ponce wrote:
> 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
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
>
>
More information about the talk
mailing list