Skip to content
Advertisement

similar to groupByKey() in Spark but using SQL queries

I trying to make

into

using only SQL queries. It is kind of similar to using groupByKey() in pyspark.

Is there a way to do this?

Advertisement

Answer

Just use conditional aggregation. One method is:

In Postgres, this would be phrased using the standard filter clause:

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