Subquery, Output / Result Name

Hi,

Trying to use subquery to extract some differences / derivatives, finding transitions in data. It’s working fine, but not quite like the documentation seems to state - I think :laughing:. For example, with this query,

SELECT count(*) as value FROM (SELECT * FROM (SELECT difference(*) as "diff" FROM (SELECT difference(last("latest-handshake"))/abs(difference(last("latest-handshake"))) AS "wgState" FROM "wireguard"."autogen"."peer" GROUP BY time(3m))) WHERE time > now()-24h AND time < now() AND diff_wgState < 0) GROUP BY "interface", "peerName"

I would expect the output result / name to be “value”. But it’s not, it’s rather,

name: peer
tags: interface=wg0, peerName=test
time                 value_diff_wgState
----                 ------------------
1970-01-01T00:00:00Z 3

So it seems that influx is forcing the name to be concatenated of sorts. Is this right / expected? Or perhaps I’m doing something wrong?

Thanks!