mysql 实现row_number,获取上一条,下一条
代码思路如下:
select *,(@row_num:=@row_num+1) as row_no from stc_output,(select(@row_num:=0)) b;
select * from (select *,(@row_num:=@row_num+1) as row_no from stc_output,(select(@row_num:=0)) b) a where a.row_no=2;
代码思路如下:
select *,(@row_num:=@row_num+1) as row_no from stc_output,(select(@row_num:=0)) b;
select * from (select *,(@row_num:=@row_num+1) as row_no from stc_output,(select(@row_num:=0)) b) a where a.row_no=2;