Q&A for professional and enthusiast programmers
SELECT votetype.name as type, post.posttypeid as posttype, count(*) as count FROM votetypes as votetype inner join votes as vote on vote.votetypeid = votetype.id inner join posts as post on vote.postid = post.id AND post.owneruserid = ##userid## GROUP BY votetype.name, post.posttypeid