ZDSXH LDSXH ZDSXH2
10 10
20 30
30 50
40 70
50 80
51 80
60 100
70 140
80 140
90 140求SQL语句,使得ZDSXH2为以下结果:
9
29
49
69
78
79
99
137
138
139即若LDSXH唯一的话,ZDSXH2就=LDSXH-1
如果不唯一,就代表这个路段上有2个以上站点(N个站点),我要让他按照ZDSXH的值大小分别=LDSXH-N,LDSXH-(N-1),LDSXH-(N-2)……
10 10
20 30
30 50
40 70
50 80
51 80
60 100
70 140
80 140
90 140求SQL语句,使得ZDSXH2为以下结果:
9
29
49
69
78
79
99
137
138
139即若LDSXH唯一的话,ZDSXH2就=LDSXH-1
如果不唯一,就代表这个路段上有2个以上站点(N个站点),我要让他按照ZDSXH的值大小分别=LDSXH-N,LDSXH-(N-1),LDSXH-(N-2)……
解决方案 »
- oracle安装:SID已存在
- HP-Unix安装oracle 10g错误
- asp.net如何连接远程oracle服务器
- 调存储过程不能带SCHEMA???
- ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小
- 请问sys.v$session视图是由什么表创建而来的?
- 为什么,我的三层结构不能在跨网段上用?
- ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","insert into AppLog nolo...","sql area","kglhin: temp")
- OracleOraHome81ManagementServer 总是启动失败了
- 我想要判断一个数是否为整型,用什么函数
- 想将一条SQL语句作为一个字段插入
- 怎么去优化这条SQL语句呢?
(select t.ZDSXH,t.LDSXH,row_number() over(partition by t.LDSXH order by t.ZDSXH desc) val from test_table t)
order by ZDSXH;
from(
select zdsxh,ldsxh,count(*) over(partition by ldsxh order by zdsxh desc) v from tt_03
)
order by zdsxh
1 select ldsxh-rn zdsxh2
2 from
3 (
4 select row_number() over(partition by ldsxh order by zdsxh2) rn,ldsxh
5 from t1
6 )
7* order by zdsxh2
SQL> / ZDSXH2
----------
9
29
49
69
78
79
99
137
138
139已选择10行。