I have data in a PostgreSQL database in the following format:
unique_key category date_period value
So for example.
agriculture_all agriculture 2021 15
agriculture_partial agriculture 2021 10
science_all science 2021 83
science_partial science 2021 32
The query I want to run is to GROUP BY based on category and date_period, but then to display the values next to each other.
**[query here]**
output:
category date_period all partial
agriculture 2021 15 10
science 2021 83 32
It feels like a really simple request but I'm struggling to get it working right in SQL. Any advice appreciated.