Merge TagSynonyms and Tags

0

Please login or register to vote for this query.

(click on this box to dismiss)

Amateur Radio

Q&A for amateur radio enthusiasts

Select TOP 2000 TagName, Id, Count
INTO #MyTags
From Tags
Where Tags.Count > 100
Order By Tags.Count Desc

SELECT TagName, TagSynonyms.SourceTagName, Count as TagCount
Into #MergedTags
FROM #MyTags
FULL OUTER JOIN TagSynonyms
ON TagName = TagSynonyms.TargetTagName

SELECT DISTINCT TagName,  
            STUFF((
              SELECT ' ' + TagName + '|'+ cast(SourceTagName AS nvarchar(1024))
              FROM #MergedTags b
              WHERE a.TagName = b.TagName
              FOR XML PATH('')),1,1,'') AS Synonyms
FROM #MergedTags a
Order By TagName Asc

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results