# שאילתה לספירת הקולות הנוכחית

**URL:** <https://meta.discourse.org/t/query-for-current-vote-count/240985>\
**Category:** Data & reporting\
**Tags:** topic-voting, sql-query\
**Created:** [19 בנובמבר,‏ 2021,‏ 11:54am UTC](https://meta.discourse.org/t/query-for-current-vote-count/240985 "2021-11-19T11:54:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [19 בנובמבר,‏ 2021,‏ 10:29pm UTC](https://meta.discourse.org/t/query-for-current-vote-count/240985/2 "2021-11-19T22:29:49Z")

</div>

I’m afraid this is also my first SQL query, so we’ll see how this goes… 🙂 but is this any help?

```plaintext
WITH votes AS (
    SELECT user_id, count(user_id) as Number_of_Votes
    FROM discourse_voting_votes dvv
    WHERE dvv.archive = false
    GROUP BY user_id
    ORDER BY Number_of_Votes DESC 
)
SELECT Number_of_Votes, count(*) AS Number_of_Users
FROM votes
GROUP BY Number_of_Votes
ORDER BY Number_of_Votes DESC

```

---

_[View the full topic](https://meta.discourse.org/t/query-for-current-vote-count/240985)._
