你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

project-reorder operator

Applies to: ✅Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

将输出表中的列重新排序。

Syntax

T| project-reorderColumnNameOrPattern [asc | desc | granny-asc | granny-desc] [, ...]

Learn more about syntax conventions.

Parameters

Name 类型 Required Description
T string ✔️ 输入表格数据。
ColumnNameOrPattern string ✔️ 列或列通配符模式的名称,列的排序依据。
asc、、descgranny-asc、、granny-desc string 指示在使用通配符模式时如何对列进行排序。 ascdesc 按列名分别以升序或降序对列进行排序。 granny-ascgranny-desc 分别按升序或降序排序,然后按下一个数值排序。 例如,当指定 a20 时,a100 出现在 granny-asc 之前。

Note

  • 如果未指定显式顺序,则顺序取决于源表中显示的匹配列。
  • In ambiguous ColumnNameOrPattern matching, the column appears in the first position matching the pattern.
  • project-reorder 指定列是可选操作。 未显式指定的列将显示为输出表的最后一列。
  • 若要删除列,请使用 project-away
  • 若要选择要保留的列,请使用 project-keep
  • 若要重命名列,请使用 project-rename

Returns

一张表,其中包含按运算符参数指定的顺序排列的列。 project-reorder 不会重命名或删除表中的列,因此,源表中存在的所有列都将出现在结果表中。

Examples

本节中的示例演示如何使用语法帮助你入门。

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. 可能需要修改示例查询中的表名称以匹配工作区中的表。

使用 b first 重新排序

对包含三列 (a, b, c) 的表重新排序,使第二列 (b) 显示在最前面。

print a='a', b='b', c='c'
|  project-reorder b

Output

b a c
b a c

使用第一个排序

对表中的列重新排序,使以 a 开头的列显示在其他列之前。

print b = 'b', a2='a2', a3='a3', a1='a1'
|  project-reorder a* asc

Output

a1 a2 a3 b
a1 a2 a3 b