Frequência semestral dos 5 Primeiros anos do REST

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mythology Meta

Q&A about the site for enthusiasts and scholars of mythology and folklore

SELECT * from ( 

        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2008-01-01 00:00:00' and '2008-07-01 23:59:59'
        ) AS 'Quantidade', '2008-01-01 00:00:00 até 2008-07-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2008-07-01 23:59:59' and '2009-01-01 23:59:59'
        ) AS 'Quantidade', '2008-07-01 23:59:59 até 2009-01-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2009-01-01 23:59:59' and '2009-07-01 23:59:59'
        ) AS 'Quantidade', '2009-01-01 23:59:59 até 2009-07-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2009-07-01 23:59:59' and '2010-01-01 23:59:59'
        ) AS 'Quantidade', '2009-07-01 23:59:59 até 2010-01-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2010-01-01 23:59:59' and '2010-07-01 23:59:59'
        ) AS 'Quantidade', '2010-01-01 23:59:59 até 2010-07-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2010-07-01 23:59:59' and '2011-01-01 23:59:59'
        ) AS 'Quantidade', '2010-07-01 23:59:59 até 2011-01-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2011-01-01 23:59:59' and '2011-07-01 23:59:59'
        ) AS 'Quantidade', '2011-01-01 23:59:59 até 2011-07-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2011-07-01 23:59:59' and '2012-01-01 23:59:59'
        ) AS 'Quantidade', '2011-07-01 23:59:59 até 2012-01-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2012-01-01 23:59:59' and '2012-07-01 23:59:59'
        ) AS 'Quantidade', '2012-01-01 23:59:59 até 2012-07-01 23:59:59' AS Faixa
        
UNION ALL
        SELECT(
            Select count(Posts.Id) from Posts
            left join PostTags on PostTags.PostId = Posts.Id
            left join Tags on Tags.Id = PostTags.TagId
            where Tags.TagName = 'rest'
            and Posts.CreationDate between '2012-07-01 23:59:59' and '2013-01-01 23:59:59'
        ) AS 'Quantidade', '2012-07-01 23:59:59 até 2013-01-01 23:59:59' AS Faixa
        
) TAB 
 order by Quantidade desc

Enter Parameters

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