tag "##dynamic parameter##" by month in 2010-2012

0

Please login or register to vote for this query.

(click on this box to dismiss)

forked from a different pre-existing query. Querying the entire database might result in timeouts, but fot a smaller timerange it does work. This query helps to visualize trends in popularity. However, stackoverflow is growing, so most tags will show an increasing trend as well, assuming they are a representative sample for the (statistical) population of tags.

Engineering

Q&A for professionals and students of engineering

Declare @Tag varchar(20)

set @Tag = ##tag:string##


select [Month], 
       sum(case when PostTypeId = 1 then 1 else 0 end) as Questions_for_Tag
       
from
(
  select CAST(
      cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01'
    as datetime) [Month], 
    PostTypeId
     
  from Posts p
   
    where [Tags] like '%' + @Tag + '%'
    and year(CreationDate) >= 2010
) as X

group by [Month]
order by [Month] asc

Enter Parameters

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