if(existed>0)then begin UPDATE STATISTICAL_TRAFFIC_DAY A SET (HURU,ZHUANRENGONG,RENGONGJIETING,PAIDUI,PAIDUIDUR,ZIDONGYUYIN,ZHIZIDONGYUYIN,FANGQI,FANGQIDUR,ZUIDAPAIDUIDUR,TONGHUADUR,JISHIJIETING, CHAOSHIJIETING,ZUIDATONGHUADUR,ZHUANJIE,ZHUANIVR,HUCHU,HUCHUJIETING,HUCHUTONGHUADUR,FUWUSHIJIANHURU,FEIFUWUHURU,ZHENLINGDUR,ZHUANSHOUJI,ZHUANSHOUJIJIETING,TONGHUA,YINGDADUR,MANYIDUCOUNT) = (select HURU,ZHUANRENGONG,RENGONGJIETING,PAIDUI,PAIDUIDUR,ZIDONGYUYIN,ZHIZIDONGYUYIN,FANGQI,FANGQIDUR,ZUIDAPAIDUIDUR,TONGHUADUR,JISHIJIETING, CHAOSHIJIETING,ZUIDATONGHUADUR,ZHUANJIE,ZHUANIVR,HUCHU,HUCHUJIETING,HUCHUTONGHUADUR,FUWUSHIJIANHURU,FEIFUWUHURU,ZHENLINGDUR,ZHUANSHOUJI,ZHUANSHOUJIJIETING,TONGHUA,YINGDADUR,MANYIDUCOUNT from (select max(ID)as minid, sum(HURU)as HURU,SUM(ZHUANRENGONG)as ZHUANRENGONG,SUM(RENGONGJIETING)as RENGONGJIETING,SUM(PAIDUI)as PAIDUI, SUM(PAIDUIDUR)as PAIDUIDUR,SUM(ZIDONGYUYIN)as ZIDONGYUYIN,SUM(ZHIZIDONGYUYIN)as ZHIZIDONGYUYIN,SUM(FANGQI)as FANGQI,SUM(FANGQIDUR)as FANGQIDUR, MAX(ZUIDAPAIDUIDUR)as ZUIDAPAIDUIDUR,SUM(TONGHUADUR)as TONGHUADUR,SUM(JISHIJIETING)as JISHIJIETING,SUM(CHAOSHIJIETING)as CHAOSHIJIETING,MAX(ZUIDATONGHUADUR)as ZUIDATONGHUADUR, SUM(ZHUANJIE)as ZHUANJIE,SUM(ZHUANIVR)as ZHUANIVR,SUM(HUCHU)as HUCHU,SUM(HUCHUJIETING)as HUCHUJIETING,SUM(HUCHUTONGHUADUR)as HUCHUTONGHUADUR,SUM(FUWUSHIJIANHURU)as FUWUSHIJIANHURU, SUM(FEIFUWUHURU)as FEIFUWUHURU,SUM(ZHENLINGDUR)as ZHENLINGDUR,SUM(ZHUANSHOUJI)as ZHUANSHOUJI,SUM(ZHUANSHOUJIJIETING)as ZHUANSHOUJIJIETING, SUM(TONGHUA)as TONGHUA,SUM(YINGDADUR)as YINGDADUR,SUM(MANYIDUCOUNT) as MANYIDUCOUNT FROM STATISTICAL_TRAFFIC_DAY B GROUP BY ADDUSERID,PRESOURCE,ADDTIME,MANYIDU having count(1)>1)c WHERE A.ID =c.minid) where A.ID in (select max(ID) from STATISTICAL_TRAFFIC_DAY GROUP BY ADDUSERID,PRESOURCE,ADDTIME,MANYIDU having count(1)>1); commit; delete from STATISTICAL_TRAFFIC_DAY where ID in(select min(ID) from STATISTICAL_TRAFFIC_DAY group by ADDUSERID,PRESOURCE,ADDTIME,MANYIDU having count(1)>1); commit; end; END IF;
这段代码 如何修改i呢? 我百度 mysql uptate from 没找到合适的或者没看懂.
建议给代码加上高亮
谢了,没经验. 改了高亮了
musql是个什么鬼?你把这个SQL不要弄得这么紧密,密集综合症都要犯了
j加了关键字颜色,您再看看 还晕不
@漠明奇喵: http://www.jb51.net/article/100747.htm,参考一下,没用过mysql不过你的那个更新语句应该是不对的