Last active
February 21, 2019 21:49
-
-
Save wouterds/22ba2f0e3bda4e25aacdb8037f4a4e0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
sensors.type, | |
samples.value, | |
DATE_FORMAT( | |
CONVERT_TZ( | |
samples.createdAt, | |
'+00:00', | |
'+01:00' | |
), | |
'%Y-%m-%d %h:%i %p' | |
) AS time | |
FROM samples | |
JOIN sensors ON sensors.id = samples.sensorId | |
WHERE samples.createdAt > (NOW() - INTERVAL 12 HOUR) AND samples.value = 0 | |
ORDER BY samples.createdAt ASC, sensors.type ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment