51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3907|回复: 1
打印 上一主题 下一主题

[原创] sql server---sql语句优化

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-11-16 11:38:27 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
select distinct * from  (select b.branchcode,c.name,b.AgentCode,b.AgentName,  a.AlarmYM,a.AlarmBatchNo,a.ContNo,a.RiskCode,  a.StartVisitDate,   (select codename from ldcode where codetype='PreviewType' and a.AlarmIndexType=code ) as PreviewType, a.VisitResult,a.TreatResult,   (select Codename from ldcode  where  CodeType='instype' and a.TreatResult  = Code) as instype,a.TreatViews ,a.AlarmIndexType    from LACheckVisit a left outer join LAAgentInfo b on a.AgentCode=b.AgentCode  left outer join LABranchGroupInfo c on a.branchcode=c.AgentGroup    where 1=1   and exists (select 1 from lacompanyinfo where b.BranchCode=branchcode  and citycomcode='340400'  )  and a.AlarmYM='200810'  and a.AlarmBatchNo='1'  ) as result
执行该语句的时候,消耗cpu75%,哪位大哥帮忙分析一下,有优化的余地没? 谢谢
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2008-11-16 11:39:37 | 只看该作者
小弟 在线等待,谢谢  十万火急
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-10-3 05:27 , Processed in 0.085022 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表