日期:2014-05-16  浏览次数:20726 次

该条语句运行好久,什么问题,该如何优化
update user_score set score=(score+5)
where acc_nbr in (select calling_nbr from tb_up50_call where calling_nbr!=called_nbr
 group by calling_nbr);

是score=(score+5)计算,和acc_nbr in还有group by 的问题么?
谢谢解答!

------解决方案--------------------
update user_score ,(select calling_nbr from tb_up50_call where calling_nbr!=called_nbr) b
set score=(score+5)
where acc_nbr=calling_nbr
------解决方案--------------------
--如果索引都加了,用exists效率应该会高些
update user_score set score=(score+5)
where acc_nbr exists (select calling_nbr from tb_up50_call where calling_nbr!=called_nbr
 group by calling_nbr);