郡 ID と郡名を戻したい。このクエリを修正するにはどうすればよいですか?
DECLARE @test int = 0;
select
CASE (@test)
when 0 then (SELECT co.Id, co.Description
FROM Dictionary.Counties as co
INNER JOIN CountyCollaboration as cc on cc.CountyId = co.Id
WHERE cc.CollaborationId = (SELECT cc1.CollaborationId from CountyCollaboration as cc1
WHERE cc1.CountyId = 34))
END
エラーが発生しますonly one expression can be specified in the select list when the subquery is not introduced with EXISTS.
コメントアウトしco.Description
て を戻すだけco.Id
にすると、別のエラーが発生します。subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <=, >, >=, or when the subquery is used as as expression.