Q&A for professional mathematicians
SELECT concat( 'site://tags/', t.tagname, '/info|', t.tagname, ' ', case when p.posttypeid = 4 then 'excerpt' else 'wiki' end ) [Tag Link] , p.body FROM PostHistory h JOIN Posts p ON h.PostId=p.Id inner join tags t on (t.wikipostid = p.id or t.excerptpostid = p.id) WHERE (p.PostTypeId in (4,5)) AND (h.PostHistoryTypeId in (2,5)) AND (h.UserDisplayName='user' + Convert(nvarchar(20), ##UserId##))