如何在phpmyadmin中使用预准备语句?我有一个SQL查询,但当我运行它时,它只显示一条消息,如我的查询已成功执行。我看不到结果。请帮忙。
我的SQL查询是
SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT(
'max(case when exam = ''',
exam,
''' then student end) AS `',
exam, '`'
)
) INTO @sql
from yourtable;
SET @sql
= CONCAT('SELECT ', @sql, '
from yourtable
group by id;');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;