我们有一张桌子:
q)t:([] a:("abc";"def";"ghi";"lmn"); b:("abc";"xyz";"ghi";"def"); c:1 2 3 4)
q)t
a b c
-------------
"abc" "abc" 1
"def" "xyz" 2
"ghi" "ghi" 3
"lmn" "def" 4
预期输出:将a列和b列按行匹配,并相应地更新mu列
a b c mu
---------------------
"abc" "abc" 1 match
"def" "xyz" 2 unmatch
"ghi" "ghi" 3 match
"lmn" "def" 4 unmatch
当我在查询下面运行时,输出失败
q)select a,b,c, mu:?[any a like/: b; `match; `unmatch] from t
a b c mu
---------------------
"abc" "abc" 1 match
"def" "xyz" 2 match // Issue here, since match a value of column a in all value of b
"ghi" "ghi" 3 match
"lmn" "def" 4 unmatch
答案 0 :(得分:3)
如果您希望进行逐行匹配,则可以使用match
运算符(〜)和each-both
运算符(')。
q) update mu:?[a~'b;`match;`unmatch] from t