各位讨教个问题:
有数量未知的表:first1 first2……firstn
然后有对应数量的表:sec1 sec2 ……secn
需要将除了first1外,全部其他first表中的num列更新为对应sec表中的newnum列。这个怎么样实现。假设速度要快一点的话。
谢谢了!
(本人一直做的是c++程序开发,这次是原因是调试到了数据库发生了一个逻辑错误,刚好那人不在公司了,本人只好帮忙做了,请这边的朋友帮本人个忙)
有数量未知的表:first1 first2……firstn
然后有对应数量的表:sec1 sec2 ……secn
需要将除了first1外,全部其他first表中的num列更新为对应sec表中的newnum列。这个怎么样实现。假设速度要快一点的话。
谢谢了!
(本人一直做的是c++程序开发,这次是原因是调试到了数据库发生了一个逻辑错误,刚好那人不在公司了,本人只好帮忙做了,请这边的朋友帮本人个忙)
解决方案:10分
下面是更新一个表
update first join sec on first.id = sec.id set first.num = sec.newnum
更新两张表
update first2 join sec2 on first2.id = sec2.id, first3 join sec3 on first3.id = sec3.id set first2.score = sec2.newscore, first3.score = sec3.newscore
一下更新多个表,还不知道数量。sorry
解决方案:30分
利用EXCCEL生成字符串
update sec1 s inner join first1 f on s.id=f.id set s.newnum=f.num
update sec2 s inner join first2 f on s.id=f.id set s.newnum=f.num
update sec3 s inner join first3 f on s.id=f.id set s.newnum=f.num
update sec4 s inner join first4 f on s.id=f.id set s.newnum=f.num
update sec5 s inner join first5 f on s.id=f.id set s.newnum=f.num
update sec6 s inner join first6 f on s.id=f.id set s.newnum=f.num
update sec7 s inner join first7 f on s.id=f.id set s.newnum=f.num
update sec8 s inner join first8 f on s.id=f.id set s.newnum=f.num
update sec9 s inner join first9 f on s.id=f.id set s.newnum=f.num
update sec10 s inner join first10 f on s.id=f.id set s.newnum=f.num
update sec11 s inner join first11 f on s.id=f.id set s.newnum=f.num
update sec12 s inner join first12 f on s.id=f.id set s.newnum=f.num
update sec13 s inner join first13 f on s.id=f.id set s.newnum=f.num
update sec14 s inner join first14 f on s.id=f.id set s.newnum=f.num
update sec15 s inner join first15 f on s.id=f.id set s.newnum=f.num
update sec16 s inner join first16 f on s.id=f.id set s.newnum=f.num
update sec17 s inner join first17 f on s.id=f.id set s.newnum=f.num
update sec18 s inner join first18 f on s.id=f.id set s.newnum=f.num
update sec19 s inner join first19 f on s.id=f.id set s.newnum=f.num
update sec20 s inner join first20 f on s.id=f.id set s.newnum=f.num
update sec21 s inner join first21 f on s.id=f.id set s.newnum=f.num
update sec22 s inner join first22 f on s.id=f.id set s.newnum=f.num
update sec23 s inner join first23 f on s.id=f.id set s.newnum=f.num
update sec24 s inner join first24 f on s.id=f.id set s.newnum=f.num
update sec25 s inner join first25 f on s.id=f.id set s.newnum=f.num
update sec26 s inner join first26 f on s.id=f.id set s.newnum=f.num
update sec27 s inner join first27 f on s.id=f.id set s.newnum=f.num
update sec28 s inner join first28 f on s.id=f.id set s.newnum=f.num
update sec29 s inner join first29 f on s.id=f.id set s.newnum=f.num
update sec30 s inner join first30 f on s.id=f.id set s.newnum=f.num
update sec31 s inner join first31 f on s.id=f.id set s.newnum=f.num
update sec32 s inner join first32 f on s.id=f.id set s.newnum=f.num
update sec33 s inner join first33 f on s.id=f.id set s.newnum=f.num
update sec34 s inner join first34 f on s.id=f.id set s.newnum=f.num
update sec35 s inner join first35 f on s.id=f.id set s.newnum=f.num
update sec36 s inner join first36 f on s.id=f.id set s.newnum=f.num
update sec37 s inner join first37 f on s.id=f.id set s.newnum=f.num
update sec38 s inner join first38 f on s.id=f.id set s.newnum=f.num
update sec39 s inner join first39 f on s.id=f.id set s.newnum=f.num
update sec40 s inner join first40 f on s.id=f.id set s.newnum=f.num
update sec41 s inner join first41 f on s.id=f.id set s.newnum=f.num
update sec42 s inner join first42 f on s.id=f.id set s.newnum=f.num
update sec43 s inner join first43 f on s.id=f.id set s.newnum=f.num
update sec44 s inner join first44 f on s.id=f.id set s.newnum=f.num
update sec45 s inner join first45 f on s.id=f.id set s.newnum=f.num
update sec46 s inner join first46 f on s.id=f.id set s.newnum=f.num
update sec47 s inner join first47 f on s.id=f.id set s.newnum=f.num
update sec48 s inner join first48 f on s.id=f.id set s.newnum=f.num
update sec49 s inner join first49 f on s.id=f.id set s.newnum=f.num
update sec50 s inner join first50 f on s.id=f.id set s.newnum=f.num
update sec51 s inner join first51 f on s.id=f.id set s.newnum=f.num
update sec52 s inner join first52 f on s.id=f.id set s.newnum=f.num
update sec53 s inner join first53 f on s.id=f.id set s.newnum=f.num
update sec54 s inner join first54 f on s.id=f.id set s.newnum=f.num
update sec55 s inner join first55 f on s.id=f.id set s.newnum=f.num
update sec56 s inner join first56 f on s.id=f.id set s.newnum=f.num
update sec57 s inner join first57 f on s.id=f.id set s.newnum=f.num
update sec58 s inner join first58 f on s.id=f.id set s.newnum=f.num
update sec59 s inner join first59 f on s.id=f.id set s.newnum=f.num
update sec60 s inner join first60 f on s.id=f.id set s.newnum=f.num
update sec61 s inner join first61 f on s.id=f.id set s.newnum=f.num
update sec62 s inner join first62 f on s.id=f.id set s.newnum=f.num
update sec63 s inner join first63 f on s.id=f.id set s.newnum=f.num
update sec64 s inner join first64 f on s.id=f.id set s.newnum=f.num
update sec65 s inner join first65 f on s.id=f.id set s.newnum=f.num
update sec66 s inner join first66 f on s.id=f.id set s.newnum=f.num
update sec67 s inner join first67 f on s.id=f.id set s.newnum=f.num
update sec68 s inner join first68 f on s.id=f.id set s.newnum=f.num
update sec69 s inner join first69 f on s.id=f.id set s.newnum=f.num
update sec70 s inner join first70 f on s.id=f.id set s.newnum=f.num
update sec71 s inner join first71 f on s.id=f.id set s.newnum=f.num
update sec72 s inner join first72 f on s.id=f.id set s.newnum=f.num
update sec73 s inner join first73 f on s.id=f.id set s.newnum=f.num
update sec74 s inner join first74 f on s.id=f.id set s.newnum=f.num
update sec75 s inner join first75 f on s.id=f.id set s.newnum=f.num
update sec76 s inner join first76 f on s.id=f.id set s.newnum=f.num
update sec77 s inner join first77 f on s.id=f.id set s.newnum=f.num
update sec78 s inner join first78 f on s.id=f.id set s.newnum=f.num
update sec79 s inner join first79 f on s.id=f.id set s.newnum=f.num
update sec80 s inner join first80 f on s.id=f.id set s.newnum=f.num
update sec1 s inner join first1 f on s.id=f.id set s.newnum=f.num
update sec2 s inner join first2 f on s.id=f.id set s.newnum=f.num
update sec3 s inner join first3 f on s.id=f.id set s.newnum=f.num
update sec4 s inner join first4 f on s.id=f.id set s.newnum=f.num
update sec5 s inner join first5 f on s.id=f.id set s.newnum=f.num
update sec6 s inner join first6 f on s.id=f.id set s.newnum=f.num
update sec7 s inner join first7 f on s.id=f.id set s.newnum=f.num
update sec8 s inner join first8 f on s.id=f.id set s.newnum=f.num
update sec9 s inner join first9 f on s.id=f.id set s.newnum=f.num
update sec10 s inner join first10 f on s.id=f.id set s.newnum=f.num
update sec11 s inner join first11 f on s.id=f.id set s.newnum=f.num
update sec12 s inner join first12 f on s.id=f.id set s.newnum=f.num
update sec13 s inner join first13 f on s.id=f.id set s.newnum=f.num
update sec14 s inner join first14 f on s.id=f.id set s.newnum=f.num
update sec15 s inner join first15 f on s.id=f.id set s.newnum=f.num
update sec16 s inner join first16 f on s.id=f.id set s.newnum=f.num
update sec17 s inner join first17 f on s.id=f.id set s.newnum=f.num
update sec18 s inner join first18 f on s.id=f.id set s.newnum=f.num
update sec19 s inner join first19 f on s.id=f.id set s.newnum=f.num
update sec20 s inner join first20 f on s.id=f.id set s.newnum=f.num
update sec21 s inner join first21 f on s.id=f.id set s.newnum=f.num
update sec22 s inner join first22 f on s.id=f.id set s.newnum=f.num
update sec23 s inner join first23 f on s.id=f.id set s.newnum=f.num
update sec24 s inner join first24 f on s.id=f.id set s.newnum=f.num
update sec25 s inner join first25 f on s.id=f.id set s.newnum=f.num
update sec26 s inner join first26 f on s.id=f.id set s.newnum=f.num
update sec27 s inner join first27 f on s.id=f.id set s.newnum=f.num
update sec28 s inner join first28 f on s.id=f.id set s.newnum=f.num
update sec29 s inner join first29 f on s.id=f.id set s.newnum=f.num
update sec30 s inner join first30 f on s.id=f.id set s.newnum=f.num
update sec31 s inner join first31 f on s.id=f.id set s.newnum=f.num
update sec32 s inner join first32 f on s.id=f.id set s.newnum=f.num
update sec33 s inner join first33 f on s.id=f.id set s.newnum=f.num
update sec34 s inner join first34 f on s.id=f.id set s.newnum=f.num
update sec35 s inner join first35 f on s.id=f.id set s.newnum=f.num
update sec36 s inner join first36 f on s.id=f.id set s.newnum=f.num
update sec37 s inner join first37 f on s.id=f.id set s.newnum=f.num
update sec38 s inner join first38 f on s.id=f.id set s.newnum=f.num
update sec39 s inner join first39 f on s.id=f.id set s.newnum=f.num
update sec40 s inner join first40 f on s.id=f.id set s.newnum=f.num
update sec41 s inner join first41 f on s.id=f.id set s.newnum=f.num
update sec42 s inner join first42 f on s.id=f.id set s.newnum=f.num
update sec43 s inner join first43 f on s.id=f.id set s.newnum=f.num
update sec44 s inner join first44 f on s.id=f.id set s.newnum=f.num
update sec45 s inner join first45 f on s.id=f.id set s.newnum=f.num
update sec46 s inner join first46 f on s.id=f.id set s.newnum=f.num
update sec47 s inner join first47 f on s.id=f.id set s.newnum=f.num
update sec48 s inner join first48 f on s.id=f.id set s.newnum=f.num
update sec49 s inner join first49 f on s.id=f.id set s.newnum=f.num
update sec50 s inner join first50 f on s.id=f.id set s.newnum=f.num
update sec51 s inner join first51 f on s.id=f.id set s.newnum=f.num
update sec52 s inner join first52 f on s.id=f.id set s.newnum=f.num
update sec53 s inner join first53 f on s.id=f.id set s.newnum=f.num
update sec54 s inner join first54 f on s.id=f.id set s.newnum=f.num
update sec55 s inner join first55 f on s.id=f.id set s.newnum=f.num
update sec56 s inner join first56 f on s.id=f.id set s.newnum=f.num
update sec57 s inner join first57 f on s.id=f.id set s.newnum=f.num
update sec58 s inner join first58 f on s.id=f.id set s.newnum=f.num
update sec59 s inner join first59 f on s.id=f.id set s.newnum=f.num
update sec60 s inner join first60 f on s.id=f.id set s.newnum=f.num
update sec61 s inner join first61 f on s.id=f.id set s.newnum=f.num
update sec62 s inner join first62 f on s.id=f.id set s.newnum=f.num
update sec63 s inner join first63 f on s.id=f.id set s.newnum=f.num
update sec64 s inner join first64 f on s.id=f.id set s.newnum=f.num
update sec65 s inner join first65 f on s.id=f.id set s.newnum=f.num
update sec66 s inner join first66 f on s.id=f.id set s.newnum=f.num
update sec67 s inner join first67 f on s.id=f.id set s.newnum=f.num
update sec68 s inner join first68 f on s.id=f.id set s.newnum=f.num
update sec69 s inner join first69 f on s.id=f.id set s.newnum=f.num
update sec70 s inner join first70 f on s.id=f.id set s.newnum=f.num
update sec71 s inner join first71 f on s.id=f.id set s.newnum=f.num
update sec72 s inner join first72 f on s.id=f.id set s.newnum=f.num
update sec73 s inner join first73 f on s.id=f.id set s.newnum=f.num
update sec74 s inner join first74 f on s.id=f.id set s.newnum=f.num
update sec75 s inner join first75 f on s.id=f.id set s.newnum=f.num
update sec76 s inner join first76 f on s.id=f.id set s.newnum=f.num
update sec77 s inner join first77 f on s.id=f.id set s.newnum=f.num
update sec78 s inner join first78 f on s.id=f.id set s.newnum=f.num
update sec79 s inner join first79 f on s.id=f.id set s.newnum=f.num
update sec80 s inner join first80 f on s.id=f.id set s.newnum=f.num