xg3396 发表于 2008-11-16 11:38:27

sql server---sql语句优化

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 ldcodewhereCodeType='instype' and a.TreatResult= Code) as instype,a.TreatViews ,a.AlarmIndexType    from LACheckVisit a left outer join LAAgentInfo b on a.AgentCode=b.AgentCodeleft outer join LABranchGroupInfo c on a.branchcode=c.AgentGroup    where 1=1   and exists (select 1 from lacompanyinfo where b.BranchCode=branchcodeand citycomcode='340400')and a.AlarmYM='200810'and a.AlarmBatchNo='1') as result
执行该语句的时候,消耗cpu75%,哪位大哥帮忙分析一下,有优化的余地没? 谢谢

xg3396 发表于 2008-11-16 11:39:37

小弟 在线等待,谢谢十万火急
页: [1]
查看完整版本: sql server---sql语句优化