NRQL IF statement to select wanted value

1.5k Views Asked by At

I'm trying to get one result from query in NRQL, when external is bigger than 0 then it should return average(external), if not average(thirdparty). If that was SQL, it would be easy.

SELECT  average(externalDuration) FROM Transaction...

What I want:

SELECT IF(externalDuration>0,average(externalDuration), average(ThirdPartyConnection))FROM Transaction...

I don't know if it's even possible

1

There are 1 best solutions below

0
On

It's now possible, since October 2022:

SELECT average(if(
  externalDuration > 0, 
  externalDuration, 
  ThirdPartyConnection))
FROM Transaction
TIMESERIES auto