Jorge Freitas
Jorge Freitas

Reputation: 938

Using IN Operator in Nested Select in NRQL (New Relic)

I have two different custom events.

I would like to know the storeNumber that exists in prod:tenant:StoreStatusChanged event, but does not exist in prod:order:OrderStatusUpdated.

The expected result in this example:

How can I do that?

Please check the printscreens below:

enter image description here enter image description here

Upvotes: 0

Views: 3196

Answers (1)

Will Nielsen
Will Nielsen

Reputation: 562

Given NRDB is not a relational DB there's not currently a way to JOIN two event types. Because you're wanting to find the diff between the two counts (i.e., via JOIN), there's not a way to do that at this time.

However, if you were wanting to find the sum of the store numbers between those two event types have the same properties you may be able to do something with NR's nested aggregation which approximates a UNION.

FROM prod:tenant:StoreStatusChanged, prod:order:OrderStatusUpdated
SELECT uniques(storeNumber)
WHERE tenantName = '123' 
SINCE 3 DAYS AGO

You might also checkout this post on NRQL using multiple FROMs. I know this doesn't solve your question, but perhaps it gives you other options if you have the sum. Sorry I couldn't help you more.

Upvotes: 0

Related Questions