SQL查询连续号码段
来源:互联网 发布:网络拓扑软件 编辑:程序博客网 时间:2024/04/30 15:09
--测试数据
create table stest
(
fphm int,
kshm nvarchar(10)
)
insert into stest
select 2014,'00000001'
union all
select 2014,'00000002'
union all
select 2014,'00000003'
union all
select 2014,'00000004'
union all
select 2014,'00000005'
union all
select 2014,'00000007'
union all
select 2014,'00000008'
union all
select 2014,'00000009'
union all
select 2013,'00000120'
union all
select 2013,'00000121'
union all
select 2013,'00000122'
union all
select 2013,'00000124'
union all
select 2013,'00000125'
--执行语句
select fphm,min(kshm),max(kshm)
from
(
select fphm,kshm,cast(kshm as int)-cc as s
from
(
select fphm,kshm,row_number() over(order by fphm) as cc
from stest
) xx
) b group by b.fphm,b.s
- SQL查询连续号码段
- SQL查询连续号码段
- 学习-SQL查询连续号码段的巧妙解法
- SQL查询连续号码段的巧妙解法
- 学习-SQL查询连续号码段的巧妙解法
- 学习-SQL查询连续号码段的巧妙解法
- SQL查询连续号码段的巧妙解法
- 学习-SQL查询连续号码段的巧妙解法
- ORACLE SQL: 查询连续号码段并合并的方法
- SQL查询连续号码段的巧妙解法
- 数据库中如何使用SQL查询连续号码段
- 如何sql查询出连续号码段 (单号连续性检查)
- mysql rownum 的另外一种实现方法,连续号码段查询
- oracle查询连续间隔段
- poj 3667 最长空白段+查询最左连续段
- SQL语句集锦:寻找连续号码的断号值
- SQL 连续任意区间段分组统计
- SQL多字段模糊查询
- loongson & MySQL 如何处理 /etc/lsb-base-logging.sh: line 72: RUNLEVEL: unbound variable
- Nehe OpenGL AppWizards with vs 2008
- ORACLE SQL性能优化系列(十)
- Configure and compile Python with Zlib
- 参禅
- SQL查询连续号码段
- SQL SERVER 2000 导入导出数据
- 关于网络文件系统NFS
- Moblin
- 获取成员函数的指针
- Java反射学习
- 一、狼的十大处世哲学
- Windows Socket五种I/O模型——代码全攻略(1)
- FLEX是什么及与FLASH的关系的介绍