处理驾校学员系统编号重复的问题

编程入门 行业动态 更新时间:2024-10-24 18:17:27

处理<a href=https://www.elefans.com/category/jswz/34/1744674.html style=驾校学员系统编号重复的问题"/>

处理驾校学员系统编号重复的问题



--1、检查学员编号重复的情况(非手工编号,手工编号对应TEMPXH,学员编号对应CXYBH)
--修改学员资料均是以学员编号为准的
--按理说学员编号是不允许重复的,重复是不能保存的
--只有一种可能就是当初手工调整过学员编号
select * from ec_xueyuan where cxybh in(select cxybh from ec_xueyuan where cxybh<>'' group by cxybh having(count(cxybh))>1) order by cxybh desc
--注意输出重复的学员编号,以便更新收费信息和考试信息




--2、列出重复中最大的序号的那个,注意第一步查询出来后先导出信息
select * from ec_xueyuan where xh in (select max(xh) from ec_xueyuan group by cxybh having count(cxybh)>1)


--3、更新学员编号,将序号最大的那个加个00
update ec_xueyuan set cxybh='00'+cxybh where xh in (select max(xh) from ec_xueyuan group by cxybh having count(cxybh)>1)
--update ec_xueyuan set cxybh='0155325' where xh=41513




--4、更新学员收费信息,查找收费信息只更新最后的那个收费,实在无法区分的话,此步省去
select * from ec_shoufei where cxybh='042149'
update ec_shoufei set cxybh='00'+cxybh where xh=38785


--5、更新学员考试成绩,注意区分更新那个,实在无法区分的话,此步省去
select * from ec_chengji where cxybh='042149'
update ec_chengji set cxybh='00'+cxybh where xh=387






--以下查询语句无实际意义========= 


--列出重复的学员编号资料
select * from ec_xueyuan where cxybh like '%042149%' order by xh


--手工更新学员编号,将序号最大的那个加个00
update ec_xueyuan set cxybh='00'+cxybh where xh=5553




--检查手工编号重复的情况,手工编号重复系统是允许保存的,只要学员编号不重复系统允许
select * from ec_xueyuan where ctempbh in(select ctempbh from ec_xueyuan where ctempbh<>'' group by ctempbh having(count(ctempbh))>1)

更多推荐

处理驾校学员系统编号重复的问题

本文发布于:2024-03-06 14:55:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1715607.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:驾校   学员   编号   系统

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!