You can do it using conditional aggregation:
SELECT t.productID,
MAX(CASE WHEN t.type1 = 1 THEN 1 ELSE 0 END) as type1_ind,
MAX(CASE WHEN t.type1 = 2 THEN 1 ELSE 0 END) as type2_ind,
MAX(CASE WHEN t.type1 = 3 THEN 1 ELSE 0 END) as type3_ind
FROM YourTable t
GROUP BY t.productID
This is dynamic for all productID, not just a specific one. To select a specific one, replace the group by
with your WHERE
clause.
This will return an indication for each product on every type if he has it(1) or not(0).
So for example for the data:
PRODUCTID | Type1
1 1
1 2
1 3
2 3
This will return:
PRODUCTID | TYPE1_IND | TYPE2_IND | TYPE3_IND
1 1 1 1
2 0 0 1
Or to get them all as one column use GROUP_CONCAT()
SELECT t.productID,
GROUP_CONCAT(concat('TYPE',t.type1))
FROM YourTable t
GROUP BY t.productID