sql - MySQL #1243 Unknown prepared statement handler (stmt) given to EXECUTE -
i following tutorial on installed version of mysql, it's throwing me error:
set @sql = null; select group_concat(distinct concat( 'max(if(property_name = ''', property_name, ''', value, null)) ', property_name ) ) @sql properties; set @sql = concat('select item_id, ', @sql, ' properties group item_id'); prepare stmt @sql; execute stmt; deallocate prepare stmt;
i pasting on sql editor in phpmyadmin.
i followed suggestion. no errors shown here's result:
select item_id ,max(if(property_name = 'color', value, null)) color ,max(if(property_name = 'size', value, null)) size ,max(if(property_name = 'weight', value, null)) weight properties group item_id
if have access mysql command-line, think you'll find sql code fine (as long @sql
doesn't equal null
) , issue phpmyadmin. idea wrap code in stored procedure , call
procedure.
Comments
Post a Comment