DECLARE @MOM datetime = '2020-07-01' DECLARE @YOY datetim...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Blender Meta

Q&A about the site for people who use Blender to create 3D graphics, animations, or games

DECLARE @MOM datetime = '2020-07-01'
DECLARE @YOY datetime = '2019-07-01'
DECLARE @YTD datetime = '2020-01-01'

DECLARE @UserId int = 158668

SELECT COUNT(DISTINCT A.Id) AS MOM
FROM Posts AS A
  INNER JOIN PostTags ON A.ParentId = PostTags.PostId
  INNER JOIN Tags ON PostTags.TagId = Tags.id
WHERE
  A.OwnerUserId = @UserId
  AND (TagName LIKE 'amazon%' OR TagName LIKE 'aws%')
  AND A.CreationDate >= @MOM;
  
SELECT COUNT(DISTINCT A.Id) AS YOY
FROM Posts AS A
  INNER JOIN PostTags ON A.ParentId = PostTags.PostId
  INNER JOIN Tags ON PostTags.TagId = Tags.id
WHERE
  A.OwnerUserId = @UserId
  AND (TagName LIKE 'amazon%' OR TagName LIKE 'aws%')
  AND A.CreationDate >= @YOY;

SELECT COUNT(DISTINCT A.Id) AS YTD
FROM Posts AS A
  INNER JOIN PostTags ON A.ParentId = PostTags.PostId
  INNER JOIN Tags ON PostTags.TagId = Tags.id
WHERE
  A.OwnerUserId = @UserId
  AND (TagName LIKE 'amazon%' OR TagName LIKE 'aws%')
  AND A.CreationDate >= @YTD;

Enter Parameters

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