SELECT Count(*)
FROM headcount
WHERE [mso/bu2] = @MSOBU
AND [status] = 'billable'
AND [location type] = 'offshore'
AND [vertical group] = @Vertical
AND lob IN(CASE
WHEN @LOB = 'dgtl' THEN (SELECT DISTINCT lob
FROM lob
WHERE category = 'esg')
WHEN @LOB = 'nondgtl' THEN (SELECT DISTINCT lob
FROM lob
WHERE category <> 'esg')
WHEN @LOB = '' THEN (SELECT DISTINCT lob
FROM headcount)
END)
我陷進這個錯誤,即使我使用IN子句SQL Server子查詢返回了多個值。這當子查詢跟隨不允許=,!=,<, <= , >,> =(即使我使用IN子句)
而不是獨特的嘗試頂部1 –
沒有我不能因爲該列有多個值 – Vickyster
THEN子句可能不會返回超過1個值。 – jarlh