首页 新闻 会员 周边 捐助

修改orcale存储过程到mysql

-1
悬赏园豆:40 [待解决问题]
复制代码
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 没找到合适的或者没看懂.

漠明奇喵的主页 漠明奇喵 | 初学一级 | 园豆:46
提问于:2017-12-22 17:04
< >
分享
所有回答(2)
0

建议给代码加上高亮

dudu | 园豆:29642 (高人七级) | 2017-12-22 17:18

谢了,没经验. 改了高亮了

支持(0) 反对(0) 漠明奇喵 | 园豆:46 (初学一级) | 2017-12-22 17:30
0

musql是个什么鬼?你把这个SQL不要弄得这么紧密,密集综合症都要犯了

SUKHOIIII | 园豆:11 (初学一级) | 2017-12-22 17:24

j加了关键字颜色,您再看看 还晕不

支持(0) 反对(0) 漠明奇喵 | 园豆:46 (初学一级) | 2017-12-22 17:30

@漠明奇喵: http://www.jb51.net/article/100747.htm,参考一下,没用过mysql不过你的那个更新语句应该是不对的

支持(0) 反对(0) SUKHOIIII | 园豆:11 (初学一级) | 2017-12-22 17:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册