我正在嘗試搜索數據庫,以查找已打開14天但未被調用的情況。我檢查單詞呼叫的步驟,並可以返回步驟(沒有單詞呼叫)。條件符合時如何返回沒有行
如果工作調用存在(而不是返回單詞調用不存在的單個步驟),我不想返回該情況。
SELECT
Support_Incident.Support_Incident_Code,
Support_Incident.Company_Name,
Support_Incident.Support_Incident_Name,
Support_Incident.Severity,
Support_Incident.MF_Status_Display,
Support_Incident.MF_Action_Owner_Display,
Support_Step.Description,
DATEDIFF(hh, Last_Updated, GETDATE()) AS 'Main'
FROM
Support_Incident
INNER JOIN Support_Step
ON Support_Incident.Support_Incident_Id = Support_Step.Support_Incident_Id
AND (Support_Step.Description NOT LIKE '%phone%'
AND Support_Step.Description NOT LIKE '%call%')
INNER JOIN Employee
ON Employee.Employee_Id = Support_Incident.Owner_Id
WHERE
(DATEDIFF(hh, Support_Incident.Display_Create_Date, GETDATE()) BETWEEN 336 AND 359
AND Support_Incident.MF_Action_Owner_Display <> 'Update'
AND Support_Incident.MF_Status_Display <> 'Closed'
AND Support_Incident.MF_Status_Display <> 'Defect'
AND Support_Incident.MF_Status_Display <> 'Enhancement'
AND Employee.Rn_Descriptor = '::sName');
是否使用的是DBMS:
試試這個? –
這是一個直接向ODBC DSN執行Odbc命令的外部工具。不過,考慮到您可能會遇到某些問題,我只是嘗試在SQL Server 2012 Management Studio中執行它 - 同樣的結果 - 我得到了所有不包含該短語的步驟,如果其中一個步驟包含該短語,我不希望返回任何這些步驟。 – DannyD