# Need a value from the db, not sure how to get it

**URL:** <https://www.ruby-forum.com/t/need-a-value-from-the-db-not-sure-how-to-get-it/261182>\
**Category:** Uncategorized\
**Created:** [April 3, 2021, 1:13pm UTC](https://www.ruby-forum.com/t/need-a-value-from-the-db-not-sure-how-to-get-it/261182 "2021-04-03T13:13:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![merlin2049er](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7feea3/32.png) [@merlin2049er](https://www.ruby-forum.com/u/merlin2049er)\
**Post date:** [April 3, 2021, 1:13pm UTC](https://www.ruby-forum.com/t/need-a-value-from-the-db-not-sure-how-to-get-it/261182/1 "2021-04-03T13:13:41Z")

</div>

I have a table called poll\_options, and the column ‘count’

I need the sum of that for a specific poll id.

Not quite sure how to get that.

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![jforbe](https://www.ruby-forum.com/user_avatar/www.ruby-forum.com/jforbe/32/230_2.png) [@jforbe](https://www.ruby-forum.com/u/jforbe)\
**Post date:** [April 6, 2021, 2:09pm UTC](https://www.ruby-forum.com/t/need-a-value-from-the-db-not-sure-how-to-get-it/261182/2 "2021-04-06T14:09:51Z")

</div>

PollOption.sum(:count).where(poll\_id: ‘123abc’)
