Hello, I’m facing issues with timezone in subqueries.
We are storing the data in GMT and query it using TZ(‘Asia/Calcutta’).
The following query works:
select max(counts) as max from meas where tad_id=‘tag1’ and time >= ‘2019-04-29 00:00:00’ and time <=‘2019-04-29 23:59:59’ group by time(1h) TZ(‘Asia/Calcutta’)
However, when I use the same query as a subquery the TZ(‘Asia/Calcutta’) is not applied correctly.
select sum(max) from (select max(counts) as max from meas where tad_id=‘tag1’ and time >= ‘2019-04-29 00:00:00’ and time <=‘2019-04-29 23:59:59’ group by time(1h) TZ(‘Asia/Calcutta’));
I have attached the results from the max query. However, with the sum query we get 7455 instead of 13675.
Looking forward to any suggestions.