per site vote count

0

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language Meta

Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language

select count(distinct case p.posttypeid when 1 then p.id else null end) Q
     , count(distinct case p.posttypeid when 2 then p.id else null end) A
     , count(distinct case v.votetypeid when 1 then v.id else null end) accept
     , count(distinct case v.votetypeid when 2 then v.id else null end) up
     , count(distinct case v.votetypeid when 3 then v.id else null end) down
from users u
inner join 
      posts p on
            p.owneruserid = u.id
inner join 
      votes v on 
            v.postid = p.id and votetypeid in ( 1,2,3)
where u.id = 811
group by u.displayname, u.id, u.upvotes, u.downvotes


select count(*)
from posts p 
inner join votes v on v.postid = p.id
where v.votetypeid = 1 and p.owneruserid = 811

Enter Parameters

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