Redwolf, Caird, Hyper closing trio

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

select postid as [Post Link]
     , [user 1] as [User Link]
     , [user 2] as [User Link]
from
(
    select postid 
         --- userid here
         , sum(case when voterid = 66833 then  66833 else null end) [User 1]
         , sum(case when voterid = 79857 then  79857 else null end) [User 2]
         , sum(case when voterid = 68942 then  68942 else null end) [User 3]
    from posthistory ph
    cross apply openjson(text, '$.Voters') 
       with (
         VoterId Int '$.Id', 
         DisplayName nvarchar(200) '$.DisplayName') voters 
    where ph.posthistorytypeid = 10
    -- userid here  -- V
    and voterid in (66833, 79857, 68942)
    and text is not null
    group by postid
) data
where [user 1] is not null 
  and [user 2] is not null

Enter Parameters

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