Simulate SQL JOIN functions in Insights

NRQL does not have an equivalent SQL-like JOIN function. Also, there is no equivalent for nested queries or subqueries.

You can simulate a JOIN by sending custom attributes as part of an event to then use in a query's WHERE or FACET clause.

Simulate SQL JOIN with custom attributes

To gain more in-depth data from your application, set up custom attributes for available events.

For example, you want to know which browsers are experiencing the highest web duration for a specific product purchase. You could add an Insights custom attribute named Product to your application's purchase transaction method. Then you could run this Insights query:

SELECT max(duration), average(duration), max(backendDuration), average(backendDuration) 
FROM PageView 
WHERE Product = 'Hat' 
FACET userAgentName 
SINCE 7 days ago

For more help

Recommendations for learning more: