奇葛格的BLOG

红尘最可笑,我自乐逍遥

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  59 随笔 :: 23 文章 :: 11 评论 :: 0 Trackbacks
create table t1(no number);
insert into t1 values(133010);
insert into t1 values(133024);
insert into t1 values(133036);
insert into t1 values(133037);
insert into t1 values(133038);
insert into t1 values(133039);
insert into t1 values(133046);
insert into t1 values(133191);
insert into t1 values(133192);
insert into t1 values(133193);
insert into t1 values(133194);
insert into t1 values(133207);

select no from (
    select no,lag(no,1,null) over(order by no) no1,no-lag(no,1,null) over(order by no) bal
    from t1)
where bal=1
union
select no1 from (
    select no,lag(no,1,null) over(order by no) no1,no-lag(no,1,null) over(order by no) bal
    from t1)
where bal=1;
posted on 2006-11-16 18:34 奇葛格 阅读(312) 评论(0)  编辑  收藏 所属分类: 数据库|Oracle,Mysql

只有注册用户登录后才能发表评论。


网站导航: