【问题标题】:kdb+ Q : select from table where column value =kdb+ Q : 从表中选择列值 =
【发布时间】:2021-10-01 12:52:54
【问题描述】:

如何从表中选择特定列值等于某值的所有行? 我尝试了以下方法:

select from tablname where columnvalue = value

谢谢

【问题讨论】:

    标签: kdb


    【解决方案1】:

    你可以这样做:

    q)table:([]a:1 2 3 4 5;b:`a`b`c`d`e;c:`hi`bye`bye`bye`hi)
    q)table
    a b c
    -------
    1 a hi
    2 b bye
    3 c bye
    4 d bye
    5 e hi
    q)select from table where c=`bye
    a b c
    -------
    2 b bye
    3 c bye
    4 d bye
    

    【讨论】:

    • 你也可以对数字列应用相同的select from table where a =1
    【解决方案2】:

    你可以这样做:

    q)tbl:([] a:1 2 3;b:4 5 6;c:7 8 9)
    q)tbl
    a b c
    -----
    1 4 7
    2 5 8
    3 6 9
    q)select a from tbl
    a
    -
    1
    2
    3
    

    【讨论】:

    • 谢谢,我如何从 tbl where a = something 中选择?
    • 您是在检查列中的列值还是检查列是否存在?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多