Execute statement only returns #Rows

旧巷老猫 提交于 2019-12-10 22:07:00

问题


I'm using PMA to test some pivot queries (dynamic columns), everything seems to be working just fine however, I'm only getting the # Rows in my results, not the actual set of rows.

How can I see my result set?

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;

Returns # Rows: 440

SELECT * FROM table - Returns the actual set of rows


回答1:


This will be resolved in the latest PHPMyAdmin builds, and should be released in version 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



来源:https://stackoverflow.com/questions/29240965/execute-statement-only-returns-rows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!