i want to do this:
select from inp where p=first exec p from u where u=m but i have to do this; select k,v from inp where {inp[p]=first exec p from u where u=`m}
is there a better way?
q)meta inp
c
t f a
u
s
p
s p
k
s
v
q)meta p
c
t f a
-
-----
p
s
s
C
q)select from inp where p=first exec p from u where u=`m
'type
q)select k,v from inp where {inp[p]=first exec p from u where u=m}
To: personal-kdbplus@googlegroups.comX-Mailer: Apple Mail (2.1499)name resolution in nested select/exec gets this confused as the second table and a column inside the first table are both being called ut(he where clause on the second table does not matter in this case)q)select x from inp where p in exec p from 0N!ummj'typea possible workaround is the way you demonstrated - a functionyou could call your second table something elseq)inp:([]u:mmj;p:p1p2p1;x:0 1 2);t:([u:mj]p:p1p1)q)select x from inp where p in exec p from t where u=mx-02or the column in the first tableq)inp:(v:mmj;p:p1p2p1;x:0 1 2);t:([u:mj]p:p1p1)q)select x from inp where p in exec p from u where u=mx-02name resolution is:column-namelocalglobaleasy to confirm withq)x:gq){exec count[i]#x from(enlistc)}p,cq){exec count[i]#x from([]y:enlistc)}p,pq){exec count[i]#x from(y:enlistc)}p,gCheers, AttilaOn 20 Feb 2013, at 22:56, Jack Andrews <jack> wrote:> hi guys,> > i want to do this:> select from inp where p=first exec p from u where u=m> but i have to do this;> select k,v from inp where {inp[p]=first exec p from u where u=m}> > is there a better way?> > q)meta inp> c| t f a> -| -----> u| s> p| s p> k| s> v|> q)meta p> c| t f a> -| -----> p| s> s| C> q)select from inp where p=first exec p from u where u=m> 'type> q)select k,v from inp where {inp[p]=first exec p from u where u=`m}> k v> ----------------------------> price 0.04 0.2 0.002 0.1> vol 100 120> > – >