I am selecting everything from prod_drop and joining 2 other tables for additional data. I do not want any of the rows from prod_drop to be repeated, I just want 1 row for each prod_drop row.
Here is my query:
SELECT
prod_drop.*
, prod_drop_products.product_id
, cart_product.product_image_sm
FROM
prod_drop
LEFT JOIN
prod_drop_products
ON
prod_drop.prod_drop_id = prod_drop_products.prod_drop_id
LEFT JOIN
cart_product
ON
prod_drop_products.product_id = cart_product.product_id
ORDER BY
prod_drop_id
DESC
These are the results:
prod_drop_id prod_drop_name prod_drop_available product_id product_image_sm
51 Carat Weight yes 4971 S5-3515Y_S.jpg
51 Carat Weight yes 4970 S5-3515Y_S.jpg
51 Carat Weight yes 4969 S5-3515Y_S.jpg
50 Carat Weight yes 4959 S5-3515_S.jpg
50 Carat Weight yes 4960 S5-3515_S.jpg
50 Carat Weight yes 4958 S5-3515_S.jpg
49 Metal Quality yes 3269 Q-8785X-14_S.jpg
49 Metal Quality yes 3270 Q-8785X-14_S.jpg
48 Gold Color yes 1635 1390-Y_S.jpg
48 Gold Color yes 1390 PE0048-12W_S.jpg
But I only want one row per prod_drop_id (doesn't matter which) so essentially I want my results to be like this:
prod_drop_id prod_drop_name prod_drop_available product_id product_image_sm
51 Carat Weight yes 4971 S5-3515Y_S.jpg
50 Carat Weight yes 4959 S5-3515_S.jpg
49 Metal Quality yes 3269 Q-8785X-14_S.jpg
48 Gold Color yes 1635 1390-Y_S.jpg
How can I do that?
Thanks!