我甚至不知道如何正確地說出這個問題。我正在嘗試編寫一個查詢案例(狀態:關閉)的查詢,檢查特定用戶是否輸入了一個便箋,如果是,請檢查該便箋後面是否添加了便條(該便條會說明案件重新開放或不)。下面是我有:我可以使用子查詢連接字符串嗎?
SELECT DISTINCT scr.CaseId, scr.AssignedSRIdent, s.RepFullName FROM dbo.SupportCaseRoot scr
INNER JOIN #comparison1 c ON c.CaseId = scr.CaseId
INNER JOIN #comparison2 c2 ON c2.CaseId = scr.CaseId
INNER JOIN dbo.servicereproot s ON s.SRIdent = scr.SRIdent
INNER JOIN dbo.SupportCaseNote scn ON scn.CaseId = scr.CaseId
WHERE scr.StatusId IN (4, 36, 37, 39, 28)
AND c.DateCreated > c2.DateCreated
AND scn.Description LIKE '%status%of%' + ' ' + (SELECT scs.Description FROM dbo.SupportCaseStatus scs WHERE scs.StatusId NOT IN (4, 36, 37, 39, 28))
ORDER BY scr.CaseId
當我運行它,我得到這個錯誤:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
我假設的最後一個AND語句和我在級聯愚蠢的嘗試,因爲。我希望它找到「[找到所有描述]的狀態」。任何人有任何建議?