Skip to content
Advertisement

Presto – pivot table

Hi I have a table like this:

I want to convert it into like this:

Advertisement

Answer

For a fixed list of properties, you can do conditional aggregation:

This puts the session id in the first column and 0/1 values in each column, depending on whether the given session owns the given property.

To generate the exact output you showed (which might be a little less helpful than the above), you would do:

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