Hello,
I have the following TSQL below, the Branches field has been truncated out most of the field content.
AS (SELECT TOP (100) PERCENT Indicator,
CAST(BranchName AS NVARCHAR(MAX)) AS Branch,
Mth
FROM [IAD].dbo.SQLDataSource
ORDER BY Indicator,
BranchName)
SELECT c.mth AS [Month],
c.Indicator,
COUNT(c.branch) AS cnt,
STUFF(
(
SELECT '; ' + x.Branch
FROM
(
SELECT TOP (100) PERCENT Indicator,
CAST(BranchName AS NVARCHAR(MAX)) AS Branch,
Mth
FROM dbo.SQLDataSource
GROUP BY Indicator,
BranchName,
Mth
ORDER BY Branch
) x
WHERE c.Indicator = x.Indicator
AND c.Mth = x.Mth
ORDER BY Branch FOR XML PATH('')
), 1, 1, '') [Branches]
FROM c
GROUP BY c.Mth,
c.Indicator
ORDER BY 1 DESC;
How could I return the full data from the Branches field?
Sam