+-----------+----------+
| colHeader | value |
+-----------+----------+
| Header1 | value 1 |
+-----------+----------+
| Header2 | value 2 |
+-----------+----------+
| Header3 | value 3 |
+-----------+----------+
Output:
+-----------+-----------+-----------+
| Header1 | header2 | Header3 |
+-----------+-----------+-----------+
| Value 1 | value 2 | Value 3 |
+-----------+-----------+-----------+
query
create table myTable (id INT, colHeader varchar(10), value varchar(10));
insert into myTable values
(1,'Header 1','Value 1'),
(1,'Header 2','Value 2'),
(1,'Header 3','Value 3');
SELECT * FROM myTable;
SELECT
GROUP_CONCAT(if(colHeader = 'Header 1', value, NULL)) AS 'Header 1',
GROUP_CONCAT(if(colHeader = 'Header 2', value, NULL)) AS 'Header 2',
GROUP_CONCAT(if(colHeader = 'Header 3', value, NULL)) AS 'Header 3'
FROM myTable;
SELECT
id,
GROUP_CONCAT(if(colHeader = 'Header 1', value, NULL)) AS 'Header 1',
GROUP_CONCAT(if(colHeader = 'Header 2', value, NULL)) AS 'Header 2',
GROUP_CONCAT(if(colHeader = 'Header 3', value, NULL)) AS 'Header 3'
FROM myTable
GROUP BY id;