一个关于update 的问题急!!!!!!!!!!!

zhao2815 2008-09-28 09:59:23
update ent_info set yjhmment =
(
select
case when (sxze<=5000000 and (ent_info.CAPITALAMOUNT <=1000
OR ent_info.LASTYEARSALE <=3000) )
then '01'
else '02'
end
from dhsxze
where dhsxze.customerid = ent_info.customerid
) where 1=1;
这个update中进行了关联表更新字段,但跑起来的时候非常慢 请问各位大虾 问题出在哪
...全文
114 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhao2815 2008-09-28
  • 打赏
  • 举报
回复
这里不加括号会报语法错误,
因为这个sql 是写在存储过程中的,不加where 1=1在跑批的时候会有中断的
对全表进行更新 还是很慢
hyqwan11112 2008-09-28
  • 打赏
  • 举报
回复


update ent_info
set yjhmment =
case when (sxze <=5000000 and (CAPITALAMOUNT <=1000 OR LASTYEARSALE <=3000) )
then '01'
else '02'
end
from ent_info,dhsxze
where ent_info.customerid = dhsxze.customerid
linux_ch 2008-09-28
  • 打赏
  • 举报
回复
建立索引
天-笑 2008-09-28
  • 打赏
  • 举报
回复


update ent_info set yjhmment =
case when (sxze <=5000000 and (ent_info.CAPITALAMOUNT <=1000 OR ent_info.LASTYEARSALE <=3000) ) then '01'
else '02' end
from ent_info inner join dhsxze on dhsxze.customerid = ent_info.customerid
dawugui 2008-09-28
  • 打赏
  • 举报
回复
update ent_info 
set yjhmment =
case when (sxze <=5000000 and (CAPITALAMOUNT <=1000 OR LASTYEARSALE <=3000) )
then '01'
else '02'
end
from ent_info,dhsxze
where ent_info.customerid = dhsxze.customerid

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧