Jasonchne
Jasonchne
2019-11-01 10:16

SQL语句优化,求大神指点

5
  • sql

如题需要优化SQL语句如下:
update a set a.syxssl = b.syxssl from #ypkcjbxx a,(select CYYMC,CWZDM,CWZMC,sum(NSL)'syxssl' from HJY_GYL_HCXS where DXHSJ between CONVERT(CHAR(10),DATEADD(month,-1,DATEADD(dd,-DAY(GETDATE())+1,GETDATE())),120)+' 00:00:00.000' and CONVERT(CHAR(10),DATEADD(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate()),0)),120)+' 23:59:59'group by CYYMC,CWZDM,CWZMC)b
where
a.yymc = b.CYYMC
and
a.hcbm = b.CWZDM

赐予执行完成需要5分钟,怎么优化,求大神指点!!

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答