Skip to content

Instantly share code, notes, and snippets.

@xlucasdemelo
Created August 2, 2017 18:37
Show Gist options
  • Save xlucasdemelo/5acd83b8f16a460a82687c31c1b990cc to your computer and use it in GitHub Desktop.
Save xlucasdemelo/5acd83b8f16a460a82687c31c1b990cc to your computer and use it in GitHub Desktop.
Timescale
SELECT equipment_attribute_id, max(value) as value, time_bucket('8 hour', created) AS created
FROM conatus.measurement
WHERE ( created >= (SELECT CURRENT_DATE - interval '1 month' ) AND equipment_attribute_id IN ( 89, 120, 108, 123, 122, 125, 124, 113, 1, 121, 168 ) AND value != 'NaN')
group by 3, equipment_attribute_id
ORDER BY 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment