2010年9月14日

oracle11g 使用first_value获取表中不连接的ID号及掉失记录数量

摘要: [select * from city t order by t.city_id]如上图中数据显示的那样,现在要求 city_id 此表中不连接的的ID号。0 ~ 11 之间丢失的数据是 1 ~ 10丢失数量 1015 ~ 21 之间丢失的数据是 16 ~ 20丢失数量5.... ....显示出来的内容应该是lost_idlost_sum1~10,16~20 15最后如下图所示:现在使用sql 显示上面的信息select wm_concat(preced_id||'~'||last_id)lose_id,sum(last_id -preced_id + 1 ) lose_sum 阅读全文

posted @ 2010-09-14 17:14 小土泥 阅读(265) 评论(0) 推荐(0) 编辑

导航