Voted for your posts, network-wide

1

Please login or register to vote for this query.

(click on this box to dismiss)

Not ready yet

Amateur Radio

Q&A for amateur radio enthusiasts

DECLARE @output TABLE (
  DbName VARCHAR(MAX),
  PostId INT,
  Created DATETIME,
  EventType VARCHAR(MAX),
  EventDate DATETIME,
  Voter1Id INT,
  Voter1Name VARCHAR(MAX),
  Voter2Id INT,
  Voter2Name VARCHAR(MAX),
  Voter3Id INT,
  Voter3Name VARCHAR(MAX),
  Voter4Id INT,
  Voter4Name VARCHAR(MAX),
  Voter5Id INT,
  Voter5Name VARCHAR(MAX)
);

DECLARE @query VARCHAR(MAX);

  SELECT
    Posts.Id as [Post Link],
    Posts.CreationDate AS Created,
    PostHistoryTypes.Name,
    PostHistory.CreationDate AS EventDate,
    CAST(JSON_VALUE(Text, '$.Voters[0].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[1].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[2].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[3].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[4].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[5].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[6].Id') AS INT) AS [User Link],
    CAST(JSON_VALUE(Text, '$.Voters[7].Id') AS INT) AS [User Link]
  FROM Posts, PostHistory, PostHistoryTypes, Users
  WHERE
    PostHistory.PostId = Posts.Id
    AND
    PostHistoryTypeId IN (10, 11, 12, 13)
    AND
    Posts.OwnerUserId = Users.Id
    AND
    Users.AccountId = ##StackExchangeAccountId:INT?1988549##
    AND
    PostHistory.PostHistoryTypeId = PostHistoryTypes.Id
  ORDER BY Posts.Id, PostHistory.Id;

Enter Parameters

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