Skip to content

Commit

Permalink
Duplicate changes from rbayersdorfer-newrelic@567d3b1
Browse files Browse the repository at this point in the history
  • Loading branch information
mlobiondo-newrelic committed Mar 30, 2022
1 parent 440897b commit 135f848
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,46 @@ Here's a short video (3:21 minutes) explaining how to use `rate` to compare data
Use non-aggregator functions for non-numerical data in NRQL queries.

<CollapserGroup>
<Collapser
className="freq-link"
title={<InlineCode>accountId()</InlineCode>}
>
Use the `accountId()` function to return the account id for each event returned. This is especially useful for queries that run across multiple accounts.

This function takes no arguments.

See below:

<CollapserGroup>
<Collapser title="Get the account id for each Transaction event">
This query returns the account id associated with each Transaction event returned.

```
SELECT accountId() FROM Transaction SINCE 1 day ago
```
</Collapser>
</CollapserGroup>

<CollapserGroup>
<Collapser title="Get the count of Transaction events for each account id">
This query returns the number of Transaction events in the last day that are associated with each account id.

```
SELECT count(*) FROM Transaction FACET accountId() SINCE 1 day ago
```
</Collapser>
</CollapserGroup>

<CollapserGroup>
<Collapser title="Get the count of Transaction events for each account id specified in WHERE clause">
This query returns the number of Transaction events in the last day where the account id is specifically one of 1, 2, or 3.

```
SELECT count(*) FROM Transaction WHERE accountId() IN (1,2,3) SINCE 1 day ago
```
</Collapser>
</CollapserGroup>
</Collapser>
<Collapser
className="freq-link"
title={<InlineCode>earliest(attribute)</InlineCode>}
Expand Down

0 comments on commit 135f848

Please sign in to comment.