I want to write a mysql query to fetch distinct product_id where combination of attribute_id column for the similar product_id values to be displayed.
I tried this one:
SELECT DISTINCT(product_id) FROM oc_product_attribute WHERE (attribute_id = 26 AND CAST(text AS UNSIGNED) >= '1') and (attribute_id = 29 AND text = 'Flange')
product_id attribute_id language_id text 1 12 1 0.25 - 20 1 13 1 2500 1 14 1 30 1 15 1 130-160 1 16 1 1.00 1 17 1 0.50 1 18 1 Medium accuracy 1 19 1 PC mountable 1 20 1 N/A 2 21 1 50 2 22 1 +/- +/-100 2 23 1 +5 2 24 1 2.5 v to +/-0.625 2 25 1 DC to 20 2 26 1 1.00 2 27 1 < 1 % of FS 2 28 1 4 PIN Connector 2 29 1 Flange 2 30 1 N/A
So basically what i want is, a query should be run on different rows of similar product_id column where logical operator with concatenation and logical operators.
Please let me know, if the question is not clear.