This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
So I have a water_nutrient (among others) table with a lot of columns with nutrient values. The water nutrient data was ~roughly~ measured every 2 hours. I want to group the data and get the average of x nutrient daily.
I was able to figure out how to group and get the average and it seems to be working fine. My problem is that there are way too many columns to write inside the select statement, so I was wondering if there's a more concise "sql-esque" way that allows me to get the average of all columns without having to write a bazillion of "avg(thing) as avg_thing".
Here's what I have showing only two columns:
select
date_trunc('day',datetimestamp),
avg(no3f) as avg_no3f,
avg(no23f) as avg_no23f,
station_id
from water_nutrient
-- where station_id = 2
group by date_trunc('day',datetimestamp), station_id
order by date_trunc
Subreddit
Post Details
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...