cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

SWQL 'DISTINCT' clause not functioning

Jump to solution

I'm attempting to get distinct values from an swql query in a custom query widget, but always receive an error after adding the DISTINCT clause.

Example:

SELECT Caption From Orion.Nodes   --->   Returns all node names

SELECT DISTINCT Caption From Orion.Nodes   --->  "There was an error processing the request"

This doc (https://support.solarwinds.com/SuccessCenter/s/article/Use-SolarWinds-Query-Language-SWQL) states that "SELECT DISTINCT" is supported, but I'm not sure what I'm doing wrong. Any help is appreciated.

Thank you

Tags (1)
0 Kudos
1 Solution

Does your query have any kind of order by at the end?  the Custom Query widget gets mad when you use certain functions and don't tell it how to sort them.

-Marc Netterfield

    Loop1 Systems: SolarWinds Training and Professional Services

- Marc Netterfield, Github

View solution in original post

3 Replies

Does your query have any kind of order by at the end?  the Custom Query widget gets mad when you use certain functions and don't tell it how to sort them.

-Marc Netterfield

    Loop1 Systems: SolarWinds Training and Professional Services

- Marc Netterfield, Github

View solution in original post

Do you have more examples like that? I usually tend to play with my query in the SWQL Studio and brute force my way through the errors (I wish it would pass the error directly when it came up), but I wonder how many times I've run into something like this instead of the usual syntactical issues I almost always seem to introduce.

Thank you!

Going off the example I gave above, the following worked for me.

SELECT DISTINCT Caption FROM Orion.Nodes ORDER BY Caption ASC

0 Kudos