Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
mlobiondo-newrelic committed Jan 22, 2025
1 parent 0c0e604 commit 7b1b280
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/content/docs/nrql/nrql-syntax-clauses-functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,44 @@ As noted in our [basic NRQL syntax doc](/docs/query-your-data/nrql-new-relic-que
</Collapser>
</CollapserGroup>

You can include both the `*` wildcard and individual attributes, [functions](#non-aggregator-functions), math expressions, and [NRQL variables](#with-as-nrql-var) in the same `SELECT` statement. `*` may appear at the beginning or end of the `SELECT` list, and the additional values selected will appear at the beginning or end of the results table, respectively:
You can include both the `*` wildcard and individual attributes, [functions](#non-aggregator-functions), math expressions, and [NRQL variables](#with-as-nrql-var) in the same `SELECT` statement. `*` may appear at the beginning or end of the `SELECT` list, and the additional columns selected will appear at the beginning or end of the results table, respectively:

```sql
WITH attribute1 + attribute2 AS attrSum SELECT attrSum, attribute, function(attribute), * FROM ...
SELECT *, attribute, function(attribute), attribute1 + attribute2 FROM ...
```

```sql
SELECT *, attribute, function(attribute), attribute1 + attribute2 FROM ...
WITH attribute1 + attribute2 AS attrSum SELECT attrSum, attribute, function(attribute), * FROM ...
```

<Callout variant="tip">
Only [non-aggregator functions](#non-aggregator-functions) are supported with `*`.
Only [non-aggregator functions](#non-aggregator-functions) are supported in the `SELECT` list along with `*`.
</Callout>

<CollapserGroup>
<Collapser
id="select-star-with-columns-query"
title="Select * with additional columns"
>
This query returns all available PageView attributes with additional columns at the beginning.

```
WITH concat('(', asnLatitude, ', ', asnLongitude, ')') AS coordinates
SELECT coordinates, city, connectionSetupDuration + pageRenderingDuration AS partialDuration, *
FROM PageView
```

<img
title="select star with additional columns"
alt="select star with additional columns"
src="/images/nrql_screenshot-select-star-with-additional-columns.webp"
/>

<figcaption>
<InlineCode>SELECT *</InlineCode> with additional columns example
</figcaption>
</Collapser>
</CollapserGroup>
</Collapser>

<Collapser
Expand Down
Binary file not shown.

0 comments on commit 7b1b280

Please sign in to comment.