SyntaxFix
Write A Post
Hire A Developer
Questions
I think you just need COUNT(DISTINCT post_id) FROM votes.
COUNT(DISTINCT post_id) FROM votes
See "4.2.7. Aggregate Expressions" section in http://www.postgresql.org/docs/current/static/sql-expressions.html.
EDIT: Corrected my careless mistake per Erwin's comment.