数据库
首页 > 数据库> > mysql-Execute语句仅返回#Rows

mysql-Execute语句仅返回#Rows

作者:互联网

我正在使用PMA测试一些数据透视查询(动态列),但是一切似乎都正常,但是,我只在结果中得到#行,而不是实际的行集.

如何查看结果集?

SET @sql = NULL;
SELECT
  GROUP_CONCAT(DISTINCT
    CONCAT(
      'MAX(IF(t.week_end = ''',
      t1.week_end,
      ''', t.st_hours, NULL)) AS ''',
      t1.week_end, '\''
    )
  ) INTO @sql
FROM timesheets t1 WHERE t1.week_end > "2015-03-01";

SET @sql = CONCAT('SELECT t.assignment_id
                    , ', @sql, ' 
                   FROM timesheets t
                  LEFT JOIN timesheets t1 ON t.timesheet_id = t1.timesheet_id
                   GROUP BY t.assignment_id');

PREPARE stmt FROM @sql;
EXECUTE stmt;

返回#行:440

SELECT * FROM table-返回实际的行集

解决方法:

这将在最新的PHPMyAdmin构建中解决,并且应该在4.6版中发布.

[Prepared statements] can be sent in query as this pretty much works in phpMyAdmin right now. The only problem is displaying results. If you execute all of above, you get result just from last query (DEALLOCATE), which shows 0 rows, but if you do it without DEALLOCATE, you reportedly get 1 row, but it’s not displayed.

Reference

标签:phpmyadmin,prepared-statement,mysql
来源: https://codeday.me/bug/20191120/2044968.html