我注释掉了有问题的代码。当我注释掉这部分时,运行大约需要 5 秒。
加上额外的条件,大约需要一年(好吧,大概是 10 分钟)。
谢谢你们的帮助!
SELECT t.account as fstrAccount,
t.idno as flngID,
CASE
WHEN t.fstrType = '' THEN ''
WHEN wd.fstrWorkType = 'SUSIN1'
AND wd.fstrOwner = ' '
AND wd.flngworkkey = wr.flngworkkey
AND wr.fstrAccountType <> '007'
AND wr.fblnOpen = 1
--AND EXISTS
-- (SELECT 1
-- FROM tblIndicator id
-- WHERE id.fstrIndicator = 'EIWTCH'
-- AND id.flngVer = 0
-- AND id.flngAccountKey = wd.flngAccountKey)
THEN 'Suspended for Audit Indicator - EIC Watch For'
ELSE t.fstrTaskSource + '_TYP_' + t.fstrType
END AS fstrType,