# Stemtelling Samenvatting (per gebruiker) - alle gebruikers

**URL:** https://meta.discourse.org/t/vote-count-summary-per-user-all-users/275394
**Category:** Data & reporting
**Tags:** topic-voting, sql-query
**Created:** [15 april 2023 om 08:30 UTC](https://meta.discourse.org/t/vote-count-summary-per-user-all-users/275394 "2023-04-15T08:30:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [15 april 2023 om 08:30 UTC](https://meta.discourse.org/t/vote-count-summary-per-user-all-users/275394/1 "2023-04-15T08:30:00Z")

</div>

### Vote Count Summary (per user) - all users

_The following query gives the number of current votes, the number of archived votes, and the combined total, per user._

```sql
SELECT tvv.user_id,
       SUM(CASE when tvv.archive = FALSE THEN 1 ELSE 0 END) AS "Current Votes Cast",
       SUM(CASE when tvv.archive = TRUE THEN 1 ELSE 0 END) AS "Archived Votes",
       COUNT(tvv.user_id) AS "Total Votes Cast"
FROM topic_voting_votes tvv
GROUP BY tvv.user_id
ORDER BY tvv.user_id ASC

```
