Help with a query to determine max(aggregated_dataset)

Hi All, I’ve been using Influx by sending data from a poller into the database and want to determine the Max value of an aggregated data pair and with one query :slight_smile:

This is what I have till now
select (non_negative_derivative(“ifa”, 1s)+non_negative_derivative(“ifb”, 1s)) as “agg” from (SELECT “value” as ifa FROM “autogen”.“interface.traffic” WHERE (“hostname” = ‘192.168.1.250’ AND “ifName” = ‘0/4’) AND $timeFilter), (SELECT “value” as ifb FROM “autogen”.“interface.traffic” WHERE (“hostname” = ‘192.168.1.250’ AND “ifName” = ‘0/5’) AND $timeFilter)

and creates the aggregated dataset but if I want to determine the max(agg) it failes and do not understand why…

thanks

the answer is offcourse:
select max(agg) from(select (non_negative_derivative(“ifa”, 1s)+non_negative_derivative(“ifb”, 1s)) as “agg” from (SELECT “value” as ifa FROM “autogen”.“interface.traffic” WHERE (“hostname” = ‘192.168.1.250’ AND “ifName” = ‘0/4’) AND $timeFilter), (SELECT “value” as ifb FROM “autogen”.“interface.traffic” WHERE (“hostname” = ‘192.168.1.250’ AND “ifName” = ‘0/5’) AND $timeFilter))

Thanks for the feedback Oxygen and sorry that your post was not answered !