Tag Addition Stats

1

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

declare @TagName nvarchar(35) = ##TagName:string##;

SELECT
    NumberOfAdditions,
    TotalNewPosts,
    FORMAT(CAST(NumberOfAdditions AS DECIMAL(10, 0)) / CAST(TotalNewPosts AS DECIMAL(10, 0)),
           'P3') AS PercentAdded
    FROM (
         SELECT
             SUM(IIF(orig.Text NOT LIKE '%<' + @TagName + '>%', 1, 0)) AS NumberOfAdditions,
             COUNT(*) AS TotalNewPosts
             FROM PostHistory orig
                 INNER JOIN
             PostHistory new ON orig.PostId = new.PostId AND new.CreationDate > orig.CreationDate
             WHERE (orig.PostHistoryTypeId = 3 OR orig.PostHistoryTypeId = 6)
               AND new.PostHistoryTypeId = 6
               AND new.Text LIKE '%<' + @TagName + '>%'
         ) as RemovalData

Enter Parameters

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