[Solved] Using gridview to display string data vertically in a row

Assuming I understand your need, you could try something like the following: /* Create a mock-up table with sample data */ DECLARE @Data TABLE ( InstrumentID INT, InstrumentType VARCHAR(50), InstrumentNumber INT, NANumber INT, DateTimeFiled DATETIME, [Name] VARCHAR(255) ); INSERT INTO @Data ( InstrumentID, InstrumentType, InstrumentNumber, NANumber, DateTimeFiled, [Name] ) VALUES ( 1625168, ‘ACCOUNTS RECEIVABLE’, 1, … Read more

[Solved] Optimize query using Concat method

I would try with this : SELECT [CaseID], STUFF( (SELECT CONCAT(‘; ‘, A.[AssignedPathologist]) FROM CTE1 A WHERE A.[CaseID] = B.[CaseID] FOR XML PATH(”) ),1, 1, ” ) As [AssignedPathologist] FROM (SELECT DISTINCT CaseID CTE1 B) B; For newer versions you can use string_agg() : SELECT CASEID, STRING_AGG(AssignedPathologist, ‘; ‘) AS AssignedPathologist FROM CTE1 C1 GROUP … Read more