gpt4 book ai didi

sql-update - 更新符号长度小于 3 个字符的位置 KDB+/Q

转载 作者:行者123 更新时间:2023-12-01 23:07:07 25 4
gpt4 key购买 nike

我有一个这样的表:

test:([]column1:`A`B`C`D`E;column2:`Consumer`RealEstate`27`85`Technology)

我需要编写一个更新查询,其中 column2 的字符数为 2 或更少,但我找不到任何方法来引用要在 where 子句中使用的符号的字符长度。我该如何编写这样的查询才能得到如下结果?

test:([]column1:`A`B`C`D`E;column2:`Consumer`RealEstate`NewCategory`NewCategory`Technology)

最佳答案

完成您想要的事情的一种方法是将符号转换为字符串(即字符列表)并将 where 子句应用于每个字符串的计数:

update column2:`NewCategory from `test where 3>count each string column2

(假设您要就地应用更改,请在此处对表名使用反引号)

关于sql-update - 更新符号长度小于 3 个字符的位置 KDB+/Q,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70669178/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com