oracle sql 指定记录 作为第一条

1)查询语句

    select id,rank from rs2qtbtc ;

    结果:

     id       rank

     1       0

     2       1

     3       2

     4       3

2)查询语句

select id,rank,decode(id,4,0,1) orders from rs2qtbtc order by orders,rank;

     结果:

     id       rank      orders

     4           3            0

     1           0            1

     2           1            1

     3           2            1

猜你喜欢

转载自lihongtai.iteye.com/blog/2184937