check-query

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drones and Model Aircraft Meta

Q&A for experienced flyers, pilots, and builders of drones and model aircraft

SELECT TOP 5000
  TableEntry.Id as [Post Link],
  TableEntry.OwnerUserId as [User Link],
  Sum(TableEntry.Number) as SelfAnswers
FROM (
  SELECT 
    q.Id as Id,
    q.OwnerUserId as OwnerUserId,
    Count(p.Id) as Number
  FROM Posts q
    INNER JOIN Posts p 
      ON p.ParentId = q.Id
      AND p.OwnerUserId = q.OwnerUserId
  WHERE   
    p.OwnerUserID = q.OwnerUserId AND
    q.OwnerUserId = 993 AND
    q.Score >= 0 AND
    p.Score > 0 AND
    q.PostTypeId = 1
  GROUP BY q.Id, q.OwnerUserId
  UNION
  SELECT 
    q.Id as Id,
    q.OwnerUserId as OwnerUserId,
    Count(c.Id) as Number
  FROM Posts q
    INNER JOIN  Comments c
        ON c.PostId = q.Id
        AND c.UserId = q.OwnerUserId
  WHERE   
    q.OwnerUserId = 993 AND
    q.Score >= 0 AND
    q.PostTypeId = 1
  GROUP BY q.Id, q.OwnerUserId
  ) AS TableEntry
GROUP BY TableEntry.Id, TableEntry.OwnerUserId
Order BY SelfAnswers DESC

Enter Parameters

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