Skip to content
Advertisement

Reformatting multi-feature timeseries data with SQL

I have a table that has the following formatting:

I would like to group by day then average a set of values by a ‘feature’ column and join the results into a single table.

This would look like:

I’m able to join the average values by day using:

But, I’m not sure how I would do this by feature using an aggregate query and produce the final join. How can I pull this off?

Advertisement

Answer

You can use conditional aggregation:

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