You need to perform a PIVOT operation, which is not supported natively in MySQL (unlike some other RDBMS).
The closest you can get is to construct SQL along the following lines:
SELECT ProductId, GROUP_CONCAT(IF(Name='Brand Name' ,value,NULL)) AS `Brand Name`, GROUP_CONCAT(IF(Name='Ethernet Technology' ,value,NULL)) AS `Ethernet Technology`, GROUP_CONCAT(IF(Name='Form Factor' ,value,NULL)) AS `Form Factor`, GROUP_CONCAT(IF(Name='Media Type Supported',value,NULL)) AS `Media Type Supported` FROM search_export GROUP BY ProductId
If the possible Name values are dynamic, you could generate such SQL in a higher level language from the results of:
SELECT DISTINCT Name FROM search_export
Indeed, one could even use SQL itself:
SELECT CONCAT(' SELECT ProductId, ', GROUP_CONCAT(' GROUP_CONCAT(IF(Name=',QUOTE(Name),',value,NULL)) AS `',REPLACE(Name,'`','``'),'`' ), ' FROM search_export GROUP BY ProductId ') INTO @sql FROM ( SELECT DISTINCT Name FROM search_export ) t; PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
Note that if there are a lot of different Name values, you may need to increase group_concat_max_len from its default of 1KiB.