Answered question closed by himself

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском Meta

Вопросы и ответы о сайте для программистов

WITH Raw AS (
  SELECT PostId, Id, Text
  FROM PostHistory
  WHERE Id IN (
    SELECT MAX(Id) AS CloseEventId
    FROM PostHistory
    WHERE
      PostHistoryTypeId = 10
      AND
      PostId IN (
        SELECT Id
        FROM Posts
        WHERE ClosedDate IS NOT NULL
      )
    GROUP BY PostId
  )
)
SELECT PostId, JSON_VALUE(Text, '$.Voters[0].Id') As Voter
FROM Raw
UNION
SELECT PostId, JSON_VALUE(Text, '$.Voters[1].Id') As Voter
FROM Raw
UNION
SELECT PostId, JSON_VALUE(Text, '$.Voters[2].Id') As Voter
FROM Raw
UNION
SELECT PostId, JSON_VALUE(Text, '$.Voters[3].Id') As Voter
FROM Raw
UNION
SELECT PostId, JSON_VALUE(Text, '$.Voters[4].Id') As Voter
FROM Raw

Enter Parameters

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