Вот пример кода, который должен делать то, что вы ожидаете.
CREATE TABLE #T (
AircontractIDFK INT
,DepCity CHAR(3)
,SeatsHeld INT
)
INSERT INTO #T(
AircontractIDFK
,DepCity
,SeatsHeld
)
SELECT
AircontractIDFK
,DepCity
,SeatsHeld
FROM
(VALUES (1175, 'JFK', 29)
,(4385, 'CLT', 27)
,(4385, 'CVG', 2)
,(4389, 'ORD', 7)
,(4389, 'ORD', 24)) AS T (AircontractIDFK, DepCity, SeatsHeld)
;WITH CTE_T AS(
SELECT
AircontractIDFK
,DepCity
,SUM(SeatsHeld) AS SeatsHeld
FROM
#T
GROUP BY
AircontractIDFK
,DepCity
)
SELECT
*
,STUFF((SELECT ',' + ST.DepCity + '(' + CAST(ST.SeatsHeld AS VARCHAR(10)) + ')' FROM CTE_T ST WHERE ST.AircontractIDFK = T.AircontractIDFK FOR XML PATH('')), 1,1,'')
FROM
CTE_T T