How many questions associated with [tag1] was changed to [tag2]?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

declare @question int = 1;
declare @initTag int = 3;
declare @tagToSearch nvarchar(35) = ##tag1:string?appscript##;
declare @tagToSearch2 nvarchar(35) = ##tag2:string?google-apps-script##;

select
cast(PH.CreationDate as date),
count(Posts.Id)
from
Posts
inner join PostHistory as PH on PH.PostId = Posts.Id
where
Posts.PostTypeId = @question
and
PH.PostHistoryTypeId = @initTag
and
(
  charindex('<' + @tagToSearch + '>', PH.Text) > 0
  and
  Posts.Tags not like ('%<' + @tagToSearch + '>%')
  and
  Posts.Tags like ('%<' + @tagToSearch2 + '>%' )
)
group by
cast(PH.CreationDate as date)
order by
cast(PH.CreationDate as date) desc

Enter Parameters

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