我的SQL代码显示,max()语法有误,这是什么原因呢?

执行下面语句时,提示cannot recognize input near '(' 'select' 'max' in expression specification。

select * 
from T1 as tt1
join
(select round(rand() * ((select max(numid) from T1)-(select min(numid) from T1)) + (select min(numid) from T1)) as id) as tt2
where tt1.numid >= tt2.id
order by tt1.numid limit 100

其中,numid是通过row number()生成的序号列。

SELECT @row := @row + 1 AS idx, t1.* FROM (SELECT @row := 0) rindex,(把你的sqlf放在这里就行了,可以有序列号了) AS t1