bigdog123
bigdog123

Reputation: 11

kdb+ Q : select from table where column value =

How do i select all rows from a table where a specific column value equals something? i have tried the following:

select from tablname where columnvalue = value

thanks

Upvotes: 0

Views: 1450

Answers (2)

Tara-W
Tara-W

Reputation: 66

you could do:

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

Upvotes: 5

Maurice Lim
Maurice Lim

Reputation: 883

You could do:

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

Upvotes: 1

Related Questions