断号表查询,断号表的数据,通过查询,找出断号后的第一个值

2019-03-25 13:40|来源: 网路

使用oracle的sql语句实现,怎么做?

N1
-------------
4
5
6
7
9
10
13
14
15
要得到如下结果
N1
-----------
4
9
13

问题补充:
梦里看花 写道
select case when leag(n1,1,0) over(order by n1) - n1 >1
             then leag(n1,1,0) over(order by n1)
            when rowid = (select min(rowid) from tablename)
             then n1
            end
  from tablename
;

未测试,应该能行


测试了,可以;不过是lead函数,不是leag,谢了

相关问答

更多
  • 皖ICP备08104347号,没有符合条件的记录。这个备案号在信产部没有查到的 你可以去信产部网站,在右上方有个公共查询,在这里输入备案号查询看看
  • 货号我们是查不到的,那些都是内部的人员才能查询到的! 他们有他们的专用网站,而这些网站,我们是打不开的。NIKE货号都是9位,前6位是产品系列号,后3位配色号。再说,货号也只能是提供你产品的基本信息,作为参考,并不能当用辨别真假的关键。
  • 货号应该是359683-*** 吊牌上有完整的9位货号,9687不在货号范围内
  • 好的,问题在于动态构建选项。 您已经以这种方式组织了撇号: $jsontwo.append(""); 因此,单引号围绕此字符串的“值”部分中的城市名称,因此字符串在其遇到的第一个单个撇号处被截止。 基本上它在构造时看起来像这样: 您需要为字符串的该部分使用双引号: $jsontwo.appen ...
  • 看起来您的ticker字段中填充了大量的尾随空格。 您可以通过执行以下语句来解决此问题: UPDATE stocks SET ticker = trim(ticker) It seems like your ticker field is populated with lots of trailing spaces. You can fix this by executing this statement: UPDATE stocks SET ticker = trim(ticker)
  • 你不能 - 但如果你真的想... :)把价值放在cookie中 RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} ^kid=([0-9]+)$ RewriteRule ^ - [co=kid:%1:%{HTTP_HOST}:7200:/] # This Cond to avoid endless redirect RewriteCond %{QUERY_STRING} . RewriteRule (.*) $1? [R=permanen ...
  • 注意+' '这将会捕捉任何单个单词 例 Declare @S varchar(max) = 'FIRST_STRING SECOND_STRING THIRD_STRING' Select left(@S,charindex(' ',@S+' ')-1) 返回 FIRST_STRING Notice the +' ' this will trap any single word Example Declare @S varchar(max) = 'FIRST_STRING SECOND_STRING ...
  • 尝试这个 SELECT min(id) from tablename group by SUBSTRING(id, 1, 1) Try This SELECT min(id) from tablename group by SUBSTRING(id, 1, 1)
  • 我弄清楚这里发生了什么。 嵌入的字符是原始Word文件中的剩余部分。 不知何故,Textedit甚至其他文本编辑工具都没有正确显示它们,但它们就在那里。 因此,当导入工具到达它们时它只是吓坏了我猜并且在那时停止加载字段。 一旦我删除了所有这些字符,它就可以正常加载。 I figured out what was happening here. There were embedded characters that were leftovers from the original Word file. Som ...