「上位 3 つ」は、専門知識列で最も頻繁に発生する 3 つの要素であると想定していますが、意図したとおりでない場合は変更できます。
WITH T1 AS (
SELECT TOP(3) Expertise, COUNT(*) AS cnt
FROM Expertise
GROUP BY Expertise
ORDER BY cnt DESC
), T2 AS (
SELECT ROW_NUMBER() OVER (ORDER BY cnt DESC) AS rn, Expertise
FROM T1
)
SELECT (SELECT Expertise FROM T2 WHERE rn = 1) + ',' +
(SELECT Expertise FROM T2 WHERE rn = 2) + ',' +
(SELECT Expertise FROM T2 WHERE rn = 3)
結果:
dfdf,.NEt,fgfg