I have the same problem with (MySQL or PHP Transform rows to columns)[Mysql MySQL or PHP Transform rows to two columns dynamically. But with different header column format.
My database table
i have done with this question, below is my query version:
SELECT GROUP_CONCAT(
'MAX(IF(day(tanggal) = ',
day(tanggal),
', presensi, NULL)) AS `',
tanggal,
'`, '
order by tanggal
) INTO @sql
FROM tableName;
when running a query it show notification "Query executed OK, 1 row affected.", but result is empty, this is The table expected what looks like