How to get min and max values from multiple tags?

Hi.

Migrating from version 1 to version 2.
Java Application(influxdb-client-java:6.9.0 in use)

There is data.

------------------------ ---------------------  ----------------------           ----------------------
memory                     136.30.13.121        2023-06-27T04:24:14.937000000Z          10
memory                     136.30.13.121        2023-06-27T04:25:14.937000000Z          20
memory                     136.30.13.121        2023-06-27T04:26:14.937000000Z          30

 _measurement:string       ipAddr:string            _time:time                      _value:float
------------------------ ---------------------  ----------------------           ----------------------
memory                     160.115.110.222      2023-06-27T04:24:14.937000000Z         100
memory                     160.115.110.222      2023-06-27T04:25:14.937000000Z         200
memory                     160.115.110.222      2023-06-27T04:26:14.937000000Z         300

I want to get a minimum/maximum value regardless of IP.

The desired data shape is as follows.

_measurement:string            max:float                     min:float
--------------------  ----------------------------  ----------------------------
memory                            300                            10

In version 1.x, it was used as below.

select min(usedPercent) as min, max(usedPercent) as max from memory where ipAddr =~ /(136.30.13.121|160.115.110.222)$/

Adapting to version 2, but not easy.
Thank you.

I didn’t know if it was possible to use FluxQL in version 2.
First, we are planning to migrate to InfluxQL.

Thank you.

Hi,

You can use this in influx

from(bucket: “memory”)
|> range(start: time1, stop: time2)
|> filter(fn: (r) => r[“_measurement”] == “measurement”)
|> filter(fn: (r) => r[“tag”] == “_Value” )
|> group()
|> max()
|> min()