Skip to content

Instantly share code, notes, and snippets.

@kylejohnson
Created November 27, 2012 13:00
Show Gist options
  • Save kylejohnson/4154125 to your computer and use it in GitHub Desktop.
Save kylejohnson/4154125 to your computer and use it in GitHub Desktop.
MariaDB [house]> select time_format(from_unixtime(statDate), '%H:%i') as statDate, avg(statValue) as statValue, SensorID as Room from stats where date(from_unixtime(statDate)) = '2012-11-24' group by time_format(from_unixtime(statDate), '%H:%i'), SensorID limit 10;
+----------+-----------+------+
| statDate | statValue | Room |
+----------+-----------+------+
| 00:00 | 72.16 | 1 |
| 00:00 | 64.005 | 2 |
| 00:00 | 75.09 | 3 |
| 00:01 | 72.16 | 1 |
| 00:01 | 63.95 | 2 |
| 00:01 | 75.145 | 3 |
| 00:02 | 72.16 | 1 |
| 00:02 | 63.95 | 2 |
| 00:02 | 75.145 | 3 |
| 00:03 | 72.16 | 1 |
+----------+-----------+------+
10 rows in set (0.03 sec)
MariaDB [house]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment