Reputation: 19486
Say for example I have a table:
q)([] aa: til 5; ab: til 5; bb: til 5)
aa ab bb
--------
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
Is there a simple way of querying for just the columns that begin with a
?
Upvotes: 0
Views: 234
Reputation: 13657
If your table is in-memory and unkeyed then take (#
) can also do it for you:
{where[c!(c:cols x)like"a*"]#x}t
But Matts solution is more general and thus more useful!
Upvotes: 1
Reputation: 2800
You can use functional select
?[t;();0b;{x!x}cols[t] where cols[t] like "a*"]
https://code.kx.com/q/basics/funsql/
Upvotes: 3