test=*# select * from aromat ;
ts | val
----------------------------+-----
2018-11-08 03:58:03.817343 | 15
2018-11-07 17:19:16.863533 | 21
2018-11-08 20:53:30.31198 | 96
2018-11-09 05:13:42.023989 | 98
2018-11-08 01:12:49.251688 | 25
2018-11-07 18:05:36.255981 | 39
2018-11-08 09:04:40.172358 | 45
2018-11-08 11:00:30.383946 | 60
2018-11-08 04:23:32.004347 | 20
2018-11-07 18:14:14.978977 | 70
2018-11-08 15:06:45.772723 | 22
2018-11-09 06:14:10.775821 | 3
2018-11-07 17:19:42.409803 | 86
2018-11-09 03:33:29.925116 | 83
2018-11-08 18:13:09.312385 | 53
2018-11-08 09:26:24.350519 | 20
2018-11-08 07:03:03.639414 | 60
2018-11-08 20:25:58.252705 | 8
2018-11-08 12:51:55.163137 | 62
2018-11-09 13:11:05.221353 | 36
(20 rows)
test=*# select ts::date, avg(val) from aromat group by 1 order by 1;
ts | avg
------------+---------------------
2018-11-07 | 54.0000000000000000
2018-11-08 | 40.5000000000000000
2018-11-09 | 55.0000000000000000
(3 rows)
test=*# select ts::date, sum(val) from aromat group by 1 order by 1;
ts | sum
------------+-----
2018-11-07 | 216
2018-11-08 | 486
2018-11-09 | 220
(3 rows)
test=*# select ts::date, sum(val) from aromat where ts::date = '2018-11-09' group by 1 order by 1;
ts | sum
------------+-----
2018-11-09 | 220
(1 row)
test=*#