SELECT DATEADD(mm, (Year(Posts.CreationDate) - 1900) * ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

SELECT   DATEADD(mm, (Year(Posts.CreationDate) - 1900) * 12 + Month(Posts.CreationDate) - 1, 0) AS Month,
  Tags.TagName, Users.Location, Posts.Id,
  COUNT(*) AS Questions

FROM Tags
  LEFT JOIN PostTags ON PostTags.TagId = Tags.Id
  LEFT JOIN Posts ON Posts.Id = PostTags.PostId
  LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId
  LEFT JOIN Users ON Users.Id = Posts.OwnerUserId
WHERE
  Tags.TagName IN (
    -- G I S 
    'qgis', 'arcgis-desktop', 'arcmap'
     
  ) AND
  
  PostTypes.Name = 'Question' AND
  
  -- excluye el mes actual
  Posts.CreationDate < DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)

GROUP BY
  Year(Posts.CreationDate), Month(Posts.CreationDate), Tags.TagName,
  Users.Location, Posts.Id

ORDER BY
  Year(Posts.CreationDate), Month(Posts.CreationDate), Tags.TagName
--solo regresa 50000 registros como máximo

Enter Parameters

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