次の方法で共有


sort operator

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

入力テーブルの行の順序を 1 つ以上の列で並べ替えます。

sort演算子とorder演算子は同等です

Syntax

T| sort bycolumn [asc | desc] [nulls first | nulls last] [, ...]

Learn more about syntax conventions.

Parameters

Name タイプ Required Description
T string ✔️ 並べ替える表形式の入力。
column scalar ✔️ The column of T by which to sort. 列の値の型は、数値、日付、時刻、または文字列である必要があります。
asc または desc string asc は昇順に並べ替えられます。低から高に並べ替えられます。 既定値は desc、高から低です。
nulls first または nulls last string nulls first は先頭に null 値を配置し、 nulls last は末尾に null 値を配置します。 ascの既定値は nulls first です。 descの既定値は nulls last です。

Returns

指定された列に基づいて昇順または降順で並べ替えられた入力テーブルのコピー。

特殊な浮動小数点値の使用

入力テーブルに特別な値 nullNaN-inf 、および +infが含まれている場合、順序は次のようになります。

Value Ascending Descending
Nulls first null,NaN,-inf,-5,0,5,+inf nullNaN+inf50-5
Nulls last -inf-50+infNaNnull +inf50-5NaNnull

Note

  • Null 値と NaN 値は常にグループ化されます。
  • null 値と NaN 値の間の順序は、null と NaN の昇順と降順がないため、最初と最後のプロパティによって決まります。

Example

次の例は、各状態の最新の Storm が最初に表示される状態で、状態別の最新の Storm イベントをアルファベット順に示しています。

The examples in this article use publicly available tables in the help cluster, such as the StormEvents table in the Samples database.

The examples in this article use publicly available tables, such as the Weather table in the Weather analytics sample gallery. ワークスペース内のテーブルと一致するように、クエリ例のテーブル名を変更する必要がある場合があります。

StormEvents
| sort by State asc, StartTime desc

Output

この表には、上位 10 件のクエリ結果のみが表示されます。

StartTime State EventType ...
2007-12-28T12:10:00Z ALABAMA Hail ...
2007-12-28T04:30:00Z ALABAMA Hail ...
2007-12-28T04:16:00Z ALABAMA Hail ...
2007-12-28T04:15:00Z ALABAMA Hail ...
2007-12-28T04:13:00Z ALABAMA Hail ...
2007-12-21T14:30:00Z ALABAMA Strong Wind ...
2007-12-20T18:15:00Z ALABAMA Strong Wind ...
2007-12-20T18:00:00Z ALABAMA Strong Wind ...
2007-12-20T18:00:00Z ALABAMA Strong Wind ...
2007-12-20T17:45:00Z ALABAMA Strong Wind ...
2007-12-20T17:45:00Z ALABAMA Strong Wind ...