I have 2 tables, one called “products” and one “images”. Images of each product are stored in the “images” of the table, so I can have 5 images for each product.
I want to make a choice that extracts only 1 image for each product. I am new to associations, so I don’t know how to solve this.
I'm trying to:
SELECT *
FROM products
INNER JOIN images ON products.id=images.prod_id
WHERE products.cat='shoes'
I need to add Limit 0.1 to the image table. How can i do this?
Thanks in advance.
source
share