0

I have a sql statement that counts every second of status in TDengine.

SELECT first(ts),voltage FROM d1 where ts >= '2017-07-14 10:40:00.000' AND ts <= '2017-07-14 10:41:00.066'  INTERVAL(1s)

There are 3 seconds of data that are missing, as shown in the figure.

enter image description here

If there is no value, I would like to use a previous non-null value in the query instead. So I tried to add a FILL(PREV);. However, the result doesn't look right.

enter image description here

How do I modify this statement?

superman
  • 1
  • 4

1 Answers1

0

Maybe you can try this:

SELECT  _wstart,first(voltage) FROM d1 where ts >= '2017-07-14 10:40:00.000' AND ts <= '2017-07-14 10:41:00.066'  INTERVAL(1s) FILL(PREV)
cpvmrd
  • 51
  • 4