superman
superman

Reputation: 1

Get the timestamp of max value in TDengine

I'm trying to downsample with interval in TDengine.

I have a statement:

select _wstart, max(val) max_val, min(val) min_val from d1001 interval(5s);

enter image description here

You can see in the picture, and it is ok.

Now I want to get the timestamp for max/min value, how should I change the sql statement?

Upvotes: 0

Views: 122

Answers (1)

cpvmrd
cpvmrd

Reputation: 41

First of all, it needs to be understood that the timestamps of the maximum and minimum values are different. So they need to be obtained separately.

You can try:

select ts, max(val) max_val from d1001 interval(5s);

or

select ts, max(val) max_val from d1001 interval(5s);

Upvotes: 0

Related Questions