仅执行语句 returns #Rows
Execute statement only returns #Rows
我正在使用 PMA 测试一些数据透视查询(动态列),一切似乎都运行良好,但是,我在结果中只得到 # Rows,而不是实际的行集。
如何查看我的结果集?
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 实际行集
这将在最新的 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.
我正在使用 PMA 测试一些数据透视查询(动态列),一切似乎都运行良好,但是,我在结果中只得到 # Rows,而不是实际的行集。
如何查看我的结果集?
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 实际行集
这将在最新的 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.