Align selected time fields with the GROUP BY grain in an aggregate query.
Ava needs hourly average freezer temperature by device, but the before query tries to display raw reading time next to an average. Before: one raw timestamp is asked to represent many readings. After: each output row is one device-hour. The time field became an hour bucket in GROUP BY, so the selected time value now defines the output row instead of contradicting it. AVG(temperature) summarizes readings inside each device-hour group, which matches the facilities question. Raw reading times are replaced by MIN(read_at) and MAX(read_at) when the review needs range context, because those are valid group summaries. Choose the time bucket…
Sign up free: one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in