Hi
I have below code , above error comes when i select multiple Tenders. If 1 is selected then works fine.
SELECT distinct A.[Store No_], A.[Tender Code],
(SELECT STUFF
((SELECT ',' + D.[Batch Number] AS [text()]
FROM [Kamla Retail Limited$Store Batch Entry Line] D
WHERE D.[Date] = A.[Date] AND D.[Store No_] = A.[Store No_]
and D.[Tender Code]=A.[Tender Code]
FOR XML PATH('')), 1, 1, ''))
AS [BO]
FROM dbo.[ABS$Store Batch Entry Line] AS A
WHERE (A.Date <= @date) AND (A.[Tender Code] In (@tender)) and A.[Store No_] in (@store)