# distinct

I often use distinct to look for the value that I want to use later as filters or parameters in workbooks. For example, I see IntuneDevices table has a column called ManageBy, but I have no ideas what data we have in this column.&#x20;

```
IntuneDevices
| where Result == 'None'
| where TimeGenerated > ago (30d)
| distinct OS, JoinType,Ownership, ManagedBy, DeviceRegistrationState
```

![](/files/RU6zXyrc1Iiwh1wy47XN)

Now that I know that I have "Intune" and "Co-managed" values in ManagedBy, if I want to know what devices are Co-managed, I can run the following query

```
IntuneDevices
| where TimeGenerated > ago (7d) 
    and todatetime(LastContact) > ago(60d) //We need to convert LastContact to date time format
    and ManagedBy == 'Co-managed' //filter device are Co-managed
| summarize arg_max(TimeGenerated, *) by SerialNumber
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sandyzeng.gitbook.io/kql/kql-quick-guide/my-favorites/distinct.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
