Applies to: ✅Microsoft Fabric✅Azure Data Explorer✅Azure Monitor✅Microsoft Sentinel
하나 이상의 열을 기준으로 입력 테이블의 행을 정렬합니다.
sort
및order
연산자는 동일합니다.
Syntax
T| sort by
column [asc
| desc
] [nulls first
| nulls last
] [,
...]
Learn more about syntax conventions.
Parameters
Name | Type | 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
제공된 열을 기준으로 오름차순 또는 내림차순으로 정렬된 입력 테이블의 복사본입니다.
특수 부동 소수점 값 사용
입력 테이블에 특수 값 null
NaN
-inf
+inf
이 포함된 경우 순서는 다음과 같습니다.
Value | Ascending | Descending |
---|---|---|
Nulls first |
null ,NaN ,,-inf -5 ,0 ,5 +inf |
null ,NaN ,,+inf 5 ,0 ,-5 |
Nulls last |
-inf ,-5 ,,0 +inf ,NaN ,null |
+inf ,5 ,,0 -5 ,NaN ,null |
Note
- Null 및 NaN 값은 항상 함께 그룹화됩니다.
- null과 NaN 값 사이의 순서는 null과 NaN에 오름차순과 내림차순이 없으므로 첫 번째 속성과 마지막 속성에 의해 결정됩니다.
Example
다음 예제에서는 각 주에서 가장 최근의 폭풍이 먼저 나타나는 사전순으로 상태별 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 | ... |