See all the votes on all my different posts grouped by vote type

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers

Q&A for Drupal developers and administrators

declare @UserId int = ##UserId##;

with vote_results as (
  select votetypeid, count(*) as "number of votes"
  from posts 
  inner join votes
  on posts.id = votes.postid
  where posts.owneruserid = @Userid
  group by votetypeid
)

select *
from vote_results
inner join
votetypes
on vote_results.votetypeid = votetypes.id
order by id

Enter Parameters

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