# NQLウェア

`where` 句を使用すると、[NQL比較演算子](/platform/ja/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-operators/nql-comparison-operators.md) や [NQL論理演算子](/platform/ja/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-operators/nql-logical-operators.md) を利用してクエリーの結果をフィルタリングするための条件を追加できます。

## フィールド値を固定の参照と比較する

特定の不変条件に一致する結果をフィルタリングするために、フィールド値を固定の参照と比較します。 たとえば：

* 特定のオペレーティングシステムを持つデバイスをフィルタリングします。
* 指定されたしきい値以下の空きメモリーを持つデバイスをフィルタリングします。
* 特定のバージョンを持つバイナリをフィルタリングします。

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

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

```
...
| where <フィールド名> <比較演算子> <静的値>
```

{% endcode %}

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

Windowsオペレーティングシステムで動作するデバイスを選択してください。

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

```
過去7日間のデバイス
| where operating_system.platform == Windows
```

{% endcode %}

| 名前           | プラットフォーム |
| ------------ | -------- |
| nxt-gcarlisa | Windows  |
| nxt-wmirjam  | Windows  |

Windowsオペレーティングシステムで動作していないデバイスを選択してください。

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

```
過去7日間のデバイス
| where operating_system.platform != Windows
| リスト名とオペレーティングシステムプラットフォーム
```

{% endcode %}

| 名前          | プラットフォーム |
| ----------- | -------- |
| nxt-jdoe    | macOS    |
| nxt-vlatona | macOS    |

名前に「jo」を含むユーザーを選択してください。

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

```
過去7日間のユーザー
| where username == "*jo*"
```

{% endcode %}

| 名前          |
| ----------- |
| John Fisher |
| John Doe    |

## 2つのフィールド値をお互いに比較する

フィールド間の動的な関係に基づいて結果をフィルタリングする場合、2つのフィールド値をお互いに比較してください。 同じテーブルからのフィールドのみ、互いに比較できます。

以下のフィールドを比較できます:

* ネイティブフィールド
* コンテキストフィールド
* クエリ内で計算されたメトリック（エイリアス）
* 手動カスタムフィールド

### 構文

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

```
...
| where <フィールドAの名前> <比較演算子> <フィールドBの名前>
```

{% endcode %}

### 例 <a href="#nqlwhere-usingmultipleconditions" id="nqlwhere-usingmultipleconditions"></a>

#### ネイティブフィールドの比較

スピーカーとマイクに同じ周辺機器を使用していないユーザーを特定します。

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

```
ユーザー
| collaboration.sessionsと共に
| where participant_device.microphone != participant_device.speaker
```

{% endcode %}

#### ネイティブフィールドとコンテキストフィールドを比較する

デバイスの場所が変更されたイベントを除外します。

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

```
過去7日間のconnection.events
| where destination.country == context.location.country
```

{% endcode %}

#### ネイティブフィールドを計算されたメトリックと比較する

実行クラッシュ後にコレクターのアクティビティがないデバイスを特定します。

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

```
過去7日間のデバイス
| 過去7日間の実行クラッシュを含める
| last_crash_time = time.last()を計算する
| where last_crash_time > last_seen
```

{% endcode %}

#### ネイティブフィールドと手動カスタムフィールドを比較する

パッケージバージョンを手動カスタムフィールドに保存されている必要な準拠バージョンと比較します。

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

```
パッケージ
| where package.version == package.#required_version
```

{% endcode %}

## 複数条件の使用 <a href="#nqlwhere-usingmultipleconditions" id="nqlwhere-usingmultipleconditions"></a>

より複雑な条件を適用するために、[NQLビット演算子](/platform/ja/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-operators/nql-bitwise-operators.md)(`and` または `or`)で区切られた複数フィルターを使用してください。 フィルターの条件は、優先順位の順序を保持するためにグループ化されます。 `where`句を別々の行に置くと、複数の`and`条件を持つ1つの`where`句を作成したときと同じ結果になります。

以下のクエリは、完全に同じ結果を提供します。

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

```
過去7日間のデバイス
| where device.entity == "Lausanne" and device.hardware.type == laptop
```

{% endcode %}

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

```
過去7日間のデバイス
| where device.entity == "Lausanne" 
| where device.hardware.type == laptop
```

{% endcode %}


---

# 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://docs.nexthink.com/platform/ja/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-keywords/nql-where.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.
