I have a table which looks has the following values:
| product_id | custom_id | custom_value |
|---|---|---|
| 1 | 10 | A |
| 1 | 9 | V |
| 2 | 10 | B |
| 3 | 3 | Q |
I am looking for a mysql query to get all values from product_id once and select the row which has custom_id = "10" in case it is available. Nevertheless in case custom_id = 10 is not available for a product_id I would still like to return the product_id but also only once.
So the result I am looking for is
| product_id | custom_id | custom_value |
|---|---|---|
| 1 | 10 | A |
| 2 | 10 | B |
| 3 | NULL | NULL |
Could please someone direct me in the right direction.
select product_id, custom_id, custom_value from table where custom_id = 10
does of course only return the values for product_id "1" and "2"