U&L Tim interactions

1

Please login or register to vote for this query.

(click on this box to dismiss)

Raspberry Pi

Q&A for users and developers of hardware and software for Raspberry Pi

select convert(int,userid) as [User Link]
       , count(*) [times involved] 
from (
select json_value(text, '$.Voters[0].Id') userid
from posthistory ph
inner join posts p on p.id = ph.postid
where ph.posthistorytypeid = 10
and p.owneruserid = 674
union all
select json_value(text, '$.Voters[1].Id') userid
from posthistory ph
inner join posts p on p.id = ph.postid
where ph.posthistorytypeid = 10
and p.owneruserid = 674
union all
select json_value(text, '$.Voters[2].Id') userid
from posthistory ph
inner join posts p on p.id = ph.postid
where ph.posthistorytypeid = 10
and p.owneruserid = 674
union all
select json_value(text, '$.Voters[3].Id') userid
from posthistory ph
inner join posts p on p.id = ph.postid
where ph.posthistorytypeid = 10
and p.owneruserid = 674
union all
select json_value(text, '$.Voters[4].Id') userid
from posthistory ph
inner join posts p on p.id = ph.postid
where ph.posthistorytypeid = 10
and p.owneruserid = 674
union all
select ph.userid
from posthistory ph
inner join posts p on p.id = ph.postid
where ph.posthistorytypeid in (4,5,6)
and p.owneruserid = 674
and p.owneruserid <> ph.userid
union all
select c.userid
from comments c
inner join posts p on p.id = c.postid
where p.owneruserid = 674
and p.owneruserid <> c.userid
) allinvolved
where userid is not null
group by userid
order by count(*) desc

Enter Parameters

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