I have this query:
DECLARE @Names VARCHAR(8000)
SELECT [Number],[ErrorMessage],
(SELECT @Names = COALESCE(@Names + ',','') + [Name]
FROM [test].[dbo].[b]
WHERE [ErrorId] like '%' + CONVERT(NVARCHAR(20),Number) + '%')
)
as [ErrorHandlingName]
FROM [test].[dbo].[a]
My goal is to send each Number
into the subquery so the condition WHERE [ErrorId] like '%' + CONVERT(NVARCHAR(20),Number) + '%')
would be able to use it.
P.S I need to do it without wrapping the subquery with a function
Can someone assist ?