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;

posted @ 2014-09-02 17:49  zero@  阅读(4441)  评论(0编辑  收藏  举报