Skip to content
Advertisement

Postgres Counts based on Month and Years

I have a psql table

I want to get a break down of users points that shows their points the current month, current year, and the lifetime.

I’m a bit lost on how to do this. What would the query look like?

The final table should look like this

Advertisement

Answer

How about conditional aggregation?

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement