Skip to content
Advertisement

Aggregate data based on unix time stamp crate database

I’m very new to SQL and time series database. I’m using crate database ( it think which is used PostgreSQL).i want to aggregate the data by hour,day ,week and month. Unix time stamp is used to store the data. following is my sample database.

i tried the sql query using FROM_UNIXTIME not supported . please help me?

im looking the answer for hourly data as follows.

sensorid ,reading , timestamp

im looking the answer for monthly data is like

Advertisement

Answer

You can convert a unix timestamp to a date/time value using to_timestamp(). You can aggregate along multiple dimensions at the same time using grouping sets. So, you might want:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement