Created
November 29, 2012 13:00
-
-
Save kylejohnson/4168901 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 time_format(from_unixtime(statDate), '%H') as Date , avg( case when SensorID = 1 then StatValue ELSE 0 END) as 'Room 1' , avg( case when SensorID = 2 then StatValue ELSE 0 END) as 'Room 2' , avg( case when SensorID = 3 then StatValue ELSE 0 END) as 'Room 3' from stats where date(from_unixtime(statDate)) = curdate() group by time_format(from_unixtime(statDate), '%H') order by StatDate ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment