sno acco_no amount
1    50001     5000
2    50002     4000
3    50001     2500
4    50002     3100
5    50002     3400
6    50001     1500
I want to take 50001's last 2 records one by one.
 select sno, acco_no, amount 
 from table 
 where acco_no = 50001 
 order by tno desc fetch first 2 rows only
sno acco_no amount
  6     50001     1500
  3    50001      2500
but I want to fetch 1 by 1 record like following
1) first step
select sno, acco_no开发者_如何学C, amount 
from table 
where acco_no = 50001 
sno acco_no amount
  6     50001     1500
2) second step
select sno, acco_no, amount 
from table 
where acco_no = 50001
sno acco_no amount
  3     50001     2500
Note : should not delete any records
you can simply use LIMIT / OFFSET for that stuff, depends on the database you use... for Postgres: http://www.postgresql.org/docs/8.1/static/queries-limit.html
for MySQL the Limit-Keyword have 2 parameters for limit and offset-definition
1st
select sno, acco_no, amount 
from table 
where acco_no = 50001 LIMIT 0,1
sno acco_no amount
  3     50001     2500
2nd
select sno, acco_no, amount 
from table 
where acco_no = 50001 LIMIT 1,1
sno acco_no amount
  3     50001     2500
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论