我正在尝试找出如何更新表中单个指定行中的单个值。
我需要的是从这里开始:
表 - 之前
索引 | 价值 |
---|---|
0 | a |
1 | b |
2 | c |
为此,专门针对索引为 2 的行:
表 - 之后
索引 | 价值 |
---|---|
0 | a |
1 | c |
2 | c |
我认为这样的事情是一个开始:
table: update Value:?[Value="b";"c";Value] from table[rowIndex]
,但这只会更新并返回一行,我正在尝试找到一种方法来保持表不变并且只更改给定行中的值。
您可以使用 where 子句仅更新满足条件的位置,只要只有一行满足条件即可:
table: update Value:"c" from table where Value="b"
如果有多于一行满足条件,您可能需要使用
rowIndex
: 进行过滤
table: update Value:?[Value="b";"c";Value] from table where i=rowIndex
或者您可以跳过条件:
table: update Value:"c" from table where i=rowIndex