我有一个查询,我想在其中获取另一列的每个值的顶部x。为此,我有以下查询
SELECT *,
(@num := IF(@job = job_id, @num + 1, IF(@job := job_id, 1, 1))) row_number
FROM job_user_rank t
CROSS JOIN (SELECT @num := 0, @job := null) c
where is_match = 1
ORDER BY job_id, is_match DESC, rank DESC
然后我包装此查询并添加一个where row_number <= ?
,但是我想将该内部查询改成视图,但是出现以下错误[HY000][1351] View's SELECT contains a variable or parameter
,如何解决呢? / p>