Quantcast
Channel: TimescaleDB and PostgreSQL - Timescale Community Forum
Viewing all articles
Browse latest Browse all 291

Query combining two tables

$
0
0

I have two tables both containing a timestamp and a value. One Table has high frequency entried for the used kWh during the time period. The other is low frequency and has only entries when the produced type changes. I know would like to have a query aggregating per hour the sum of the kWh according to type.
Result could look like

Time, kWh, Typ
5:00, 4.2, 1
5:00, 8.3, 2
6:00, 2.2, 1
6:00, 4.3, 2
7:00, 9.3, 2
8:00, 7.3, 2

and so on depending how many types were running in this hour.

Is it possible to get this data with a SQL query and what would the query look like?

Thank You

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 291

Trending Articles