Q&A about the site for linguists, teachers and students of the Ukrainian language
select pt.name PostType, vt.name VoteType, count(v.id) NumVotes from posts p left join votes v on p.id=v.postid left join votetypes vt on vt.id=v.votetypeid left join posttypes pt on pt.id=p.posttypeid where p.owneruserid=##UserId## and p.DeletionDate is null and p.closeddate is null group by pt.name, vt.name having count(v.id)>0 order by pt.name desc, vt.name desc