我想执行并获得以下查询的结果:
$query = <<<SQL
set @num := 0, @priority := '';
select * from (
select
id, status_ts,
@num := if(@priority = priority, @num + 1, 1) as _row_number,
@priority := priority as priority
FROM ($priority_query) as get_priority
ORDER BY priority DESC, status_ts ASC
) as items where items._row_number <= CEIL(priority);
SQL;
返回 0 ,$sql = $PDO->query($query); $sql->rowCount()
没有结果行。我已经通过直接在数据库中执行查询来测试它并且它可以工作。