Try this...
DECLARE @ApplicantTable TABLE
(
ID INT,
ApplicantId INT
)
INSERT INTO @ApplicantTable VALUES
(117,1),
(117 ,2),
(186 ,3),
(186 ,4),
(223, 5),
(224, 6),
(556, 7),
(556, 8),
(186, 9)
SELECT ID,STUFF(( SELECT ',' + CAST(ApplicantId AS VARCHAR) FROM @ApplicantTable
WHERE ID = A.Id FOR XML PATH('') ),1,1,'')Ids
FROM @ApplicantTable A GROUP BY ID
And to get the rownumber according to the combination....
SELECT ID,ROW_NUMBER() OVER(ORDER BY Ids) RowNum,IDs FROM (
SELECT ID,STUFF(( SELECT ',' + CAST(ApplicantId AS VARCHAR) FROM @ApplicantTable
WHERE ID = A.Id FOR XML PATH('') ),1,1,'')Ids
FROM @ApplicantTable A GROUP BY ID ) A
Thank you