Percent of users who added this [tag]?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS

Q&A for administrators, end users, developers and designers for Craft CMS

declare @question int = 1;
declare @reTag int = 6;
declare @initTag int = 3;
declare @tagToSearch nvarchar(35) = ##tag:string?google-apps-script-web-application##;

SELECT
FIRST_USER as [User Link],
COUNT(PostId) AS 'COUNT',
COUNT(PostId)*100/SUM(COUNT(PostId)) OVER () AS '%'
FROM
(select
MAX(CreationDate) AS CDATE,
PostId,
FIRST_USER
--,P.PostHistoryTypeId,
--P.Text
from
(SELECT
FIRST_VALUE(PH.UserId) OVER (PARTITION BY PH.PostId ORDER BY PH.CreationDate) AS FIRST_USER,
*
FROM 
PostHistory as PH
WHERE
(PH.PostHistoryTypeId = @reTag
or
PH.PostHistoryTypeId = @initTag
)
and
PH.Text like '%<' + @tagToSearch + '>%'
) AS P
group by
PostId,FIRST_USER
--,P.PostHistoryTypeId,P.Text
) AS FULL_DATA

GROUP BY

FIRST_USER

ORDER BY

COUNT(PostId) desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results