DECLARE @MOM datetime = '2020-06-01' DECLARE @UserId int...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @MOM datetime = '2020-06-01'

DECLARE @UserId int = 158668

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

Enter Parameters

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