Conditional outcome based on sum("field")

query
influxql
#1

I’m using influxdb 1.3.5.

I’m willing to obtain several different results based on a sum operation. Say I have this query:

SELECT sum("thrsld_port_rate") FROM "stats_Ports" WHERE time >= now() - 30m group by "tag"

What I want to achieve is the following (pseudo code):

if sum("thrsld_port_rate") < 10 return 1
else sum("thrsld_port_rate") < 20 return 2
else sum("thrsld_port_rate") < 30 return 3
else return 4

Is that possible?

Thanks!