Im trying to group a set of data using date_trunc. But after executing the data i got the grouped data in Date format (DD/MM/YY). How to get it to second using query ?
Table Sensor
----------------------------------
| sensorid | reading | timestamp |
----------------------------------
| 1 | 100 | 1612331498 |
-----------------------------------
| 2 | 100 | 1614752263 |
-----------------------------------
| 1 | 10 | 1614752263 |
-----------------------------------
> select date_trunc('day', v.timestamp) as day,sum(reading) from sensor
> v(timestamp,sensorid) where sensorid=1 group by (DAY);
Output is
day sum
03/02/2021 12:00:00 am 100
03/03/2021 12:00:00 am 10
Expected result
day sum
1612331498 100
1614752263 10
im using Npgsql C# client and cratedb.
CREATE TABLE sensor (
sensorid int,
reading double,
timestamp double
);