> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/platform/~/changes/Sh4xqs4GDClkDKT9Hvux/user-guide/nexthink-query-language-nql/nql-keywords/nql-where.md).

# NQL where

A `where` clause allows you to add conditions to your query to filter the results.

### Syntax <a href="#nqlwhere-syntax" id="nqlwhere-syntax"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
...
| where <field name> <comparison operator> <field value>
```

{% endcode %}

### Examples <a href="#nqlwhere-examples" id="nqlwhere-examples"></a>

Select the devices running the Windows operating system.

{% code overflow="wrap" lineNumbers="true" %}

```
devices during past 7d
| where operating_system.platform == Windows
```

{% endcode %}

| Name         | Platform |
| ------------ | -------- |
| nxt-gcarlisa | Windows  |
| nxt-wmirjam  | Windows  |

Select the devices not running the Windows operating system.

{% code overflow="wrap" lineNumbers="true" %}

```
devices during past 7d
| where operating_system.platform != Windows
| list name, operating_system.platform
```

{% endcode %}

| Name        | Platform |
| ----------- | -------- |
| nxt-jdoe    | macOS    |
| nxt-vlatona | macOS    |

Select the users whose name contains “jo”.

{% code overflow="wrap" lineNumbers="true" %}

```
users during past 7d
| where username == "*jo*"
```

{% endcode %}

| Name        |
| ----------- |
| John Fisher |
| John Doe    |

### Using multiple conditions <a href="#nqlwhere-usingmultipleconditions" id="nqlwhere-usingmultipleconditions"></a>

Use multiple filters separated by `and` or `or` operators to apply more complex conditions. The conditions in the filter are grouped together to preserve the order of precedence. When you put `where` clauses on separate lines, the result is the same as if you created one `where` clause with multiple `and` conditions.

The following queries provide the exact same results.

{% code overflow="wrap" lineNumbers="true" %}

```
devices during past 7d
| where device.entity == "Lausanne" and device.hardware.type == laptop
```

{% endcode %}

{% code overflow="wrap" lineNumbers="true" %}

```
devices during past 7d
| where device.entity == "Lausanne" 
| where device.hardware.type == laptop
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.nexthink.com/platform/~/changes/Sh4xqs4GDClkDKT9Hvux/user-guide/nexthink-query-language-nql/nql-keywords/nql-where.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
