如何将MySQL变量传递给子查询,如下所示。
select
v.val, @var:= @var + 1 var
from
(select val from table where id=@var) v,
(select @var:= 0) var
答案 0 :(得分:1)
select
v.val ,var
from
(select val, @var:= @var + 1 var from Table1,(select @var:= 0) var where id=@var+1) v
<强>演示强>