mysql查找某连续字段中断的编号

时间:2018-10-29 16:46:06   收藏:0   阅读:248

    查询dj_pxlb表中zwh 空缺的值

         select model2.zwh-1 as kqzwh from (select model1.zwh from dj_pxlb as model1 where model1.ccbh =‘abc‘ order by model1.zwh desc) as model2 where model2.zwh>1 and not exists (select model3.zwh from dj_pxlb as model3 where  model3.ccbh =‘abc‘ and model3.zwh=model2.zwh-1);

 

原文:https://www.cnblogs.com/gaobo543013306/p/9871359.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!