रिकॉर्ड को पिवट करने के लिए यहां एक गतिशील एसक्यूएल है,
SET @sql = NULL;
SELECT GROUP_CONCAT(DISTINCT
CONCAT('MAX(CASE WHEN date = ''',
date,
''' THEN Value ELSE NULL END) AS ',
CONCAT('`', date, '`')
)) INTO @sql
FROM TableName
// WHERE date >= curdate() - interval 3 day // add condition here
ORDER BY date;
SET @sql = CONCAT('SELECT ', @sql, '
FROM TableName');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;