1

I am trying to sum the frequency of the words cumulatively in PostgreSQL

Here's my table (example)
1

I need sum accumulative frequency for same words, for example the expected results is:

resize (100 + 85) = 185

trabajar (75 + 73) = 148

partir (64) = 64

How can I make the query?

braX
  • 11,506
  • 5
  • 20
  • 33
  • 1
    How about `SELECT word, SUM(frecuency) FROM yourtable GROUP BY word` ? – Lasse V. Karlsen Nov 28 '20 at 18:03
  • Does this answer your question? [how to group by and return sum row in Postgres](https://stackoverflow.com/questions/8004655/how-to-group-by-and-return-sum-row-in-postgres) – astentx Nov 28 '20 at 20:40

1 Answers1

1

you need to use GROUP BY :

SELECT
    word
    , SUM(frecuency)
FROM tablename
GROUP BY word
eshirvana
  • 23,227
  • 3
  • 22
  • 38