WITH UserIds AS ( SELECT Id FROM Users WHERE Location LIK...

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

WITH UserIds AS (
  SELECT Id FROM Users
  WHERE Location LIKE '%Iraq%'
  OR Location LIKE '%Syria%'
  OR Location LIKE '%Iran%'
  OR Location LIKE '%Libya%'
  OR Location LIKE '%Somalia%'
  OR Location LIKE '%Sudan%'
  OR Location LIKE '%Yemen%'
),
AllQuestionIds AS (
  SELECT Id QuestionId FROM Posts WHERE PostTypeId = 1 AND OwnerUserId IN (SELECT Id FROM UserIds)
  UNION 
  SELECT ParentId QuestionId FROM Posts 
    WHERE PostTypeId = 2 AND OwnerUserId IN (SELECT Id FROM UserIds)
)
SELECT SUM(ViewCount) FROM Posts
WHERE Id IN (SELECT QuestionId FROM AllQuestionIds)

Enter Parameters

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