Reputation: 340
if I have a list and table:
a:("12";"34";"56")
bb:([]c:("90";"12";"65"))
And I do this:
a except (select c from bb)
I get the following error:
length
[5] (.q.except)
[4] a except (select c from bb)
Perhaps (select c from bb) is still a table? How do I convert a column to a list so that the except statement works?
Upvotes: 2
Views: 7246
Reputation: 1697
One option:
q)a:("12";"34";"56")
q)bb:([]c:("90";"12";"65"))
q)([]c:a) except bb
c
----
"34"
"56"
Upvotes: 1
Reputation: 823
Both perfectly good answers, but personally I prefer t[`col]
a:("12";"34";"56");
bb:([]c:("90";"12";"65"));
a except bb[`c]
It also works better if calling dynamically
Upvotes: 1
Reputation: 1341
select
does indeed output a table. If you want the output to be a list then use exec
:
q)a except exec c from bb
"34"
"56"
Upvotes: 4
Reputation: 366
Try using "exec", which will return the column as the list.
a except exec c from bb
or
a except bb`c
Upvotes: 2