I have a query like this, displaying results as a table:
FROM … SELECT a, b, c WHERE a > 0 SINCE 1 day ago
I’d like the table to be sorted in descending order by value of a, which is numeric.
If I just run the query as above, it’s not sorted by the value of a (although I can click on the column name to sort it).
Just guessing, I tried adding “ORDER BY a” to the end of the query, and that works! But it’s ascending order, with the smallest value of a at the top of the table - the opposite of what I want. I tried guessing a few ways to change the sort order but just got syntax errors.
Searching newrelic’s documentation, I do not see anything saying ORDER BY even exists, I only find feature requests for it from a few years ago. The complete syntax summary for NRQL seems to be this: https://docs.newrelic.com/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions - it doesn’t mention ORDER at all. The only mention of sorting is under FACET.
But “ORDER BY” is accepted, and does seem to have an effect. Have I stumbled onto an unannounced feature? Or am I just not finding the documentation for it?