dimanche 3 juillet 2016

MySQL #1243 Unknown prepared statement handler (stmt) given to EXECUTE


I am following this tutorial on my installed version of MySQL, but it's throwing me an error: SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT( 'MAX(IF(property_name = ''', property_name, ''', value, NULL)) AS ', property_name ) ) INTO @sql FROM properties; SET @sql = CONCAT('SELECT item_id, ', @sql, ' FROM properties GROUP BY item_id'); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; I am pasting it on SQL editor in MyPHPadmin. UPDATE: I followed the suggestion ... no errors shown but here's the result: SELECT item_id ,MAX(IF(property_name = 'color', value, NULL)) AS color ,MAX(IF(property_name = 'size', value, NULL)) AS size ,MAX(IF(property_name = 'weight', value, NULL)) AS weight FROM properties GROUP BY item_id

Aucun commentaire:

Enregistrer un commentaire