Re: [personal kdb+] Re: Obtaining the name of the linked-to column from a linked table

X-Mailer: BlackBerry Email (10.3.1.2576)Message-ID: <20150610164618.5984343.12743.1596@aquaq.co.uk>Date: Wed, 10 Jun 2015 09:46:18 -0700Subject: Re: [personal kdb+] Re: Obtaining the name of the linked-to column from a linked tableFrom: David Demner <david.demner>To: Charles Cloud , personal-kdbplus@googlegroups.com

Yes.

So if you re-sort your linked table without recreating the link your ?link will be screwed up.

Also be careful if you create a link in this way when values are missing because ? will still find an index match, again creating an incorrect link.


From: Charles Cloud

Sent: Wednesday, June 10, 2015 09:13
To: personal-kdbplus@googlegroups.com
Reply To: personal-kdbplus@googlegroups.com
Subject: [personal kdb+] Re: Obtaining the name of the linked-to column from a linked table

Yes that helps. Does it make sense to say that the values in `parent` are *always* referring to `i` of the linked table?

The index match that ? finds when values are missing is out of bounds (1+count of lookup table), which leads to null lookups which is correct.

q)t1

a b

a 1

b 2

c 3

q)t2

a c

----

b 20

d 40

q)update link:t2!t2.a?a from t1

`t1

q)t1

a b link

--------

a 1 2

b 2 0

c 3 2

q)select a,b,link.c from t1

a b c

------

a 1

b 2 20

c 3