SELECT dteRun,
CASE WHEN coalesce(nPriorityCode,0) <= 0 THEN 3
ELSE nPriorityCode
END AS nPriorityCode,
CASE WHEN sCommand IN ('DiaryWF','XC_Reminder') THEN '*'
ELSE ''
END as Alert,
sParentRef,
nWorkflowTypeCode,
sSubjectName,
sDescription,
sUniqueRef,
sUserInfo,
sUserInfo2
FROM AuroraTasksDiaryView ad
INNER JOIN UserAuthority
ON UserAuthority.UserName = ad.sOwningUser
AND ad.sOwningUser = 'ammonsd' AND ad. nErrorCode = -1
AND ad.sExcludedUser <> ad.sOwningUser
AND UserAuthority.FunctionCode = ad.sFunctionCode
AND ( (UserAuthority.LowerBound <= ad.nTaskValue
AND UserAuthority.UpperBound >= ad.nTaskValue)
OR ad.sFunctionCode = 'RTS')
AND RowNum <= 100
ORDER BY dteRun
Когда я опускаю запрос "Order By dteRun", он выполняется за миллисекунды, однако с помощью Order By Clause это занимает больше минуты.В чем проблема с Order By Clause?