# insert into tables with linked columns

**URL:** <https://forum.kx.com/t/insert-into-tables-with-linked-columns/7941>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [October 11, 2012, 5:04pm UTC](https://forum.kx.com/t/insert-into-tables-with-linked-columns/7941 "2012-10-11T17:04:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam11](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@Sam11](https://forum.kx.com/u/Sam11)\
**Post date:** [October 11, 2012, 5:04pm UTC](https://forum.kx.com/t/insert-into-tables-with-linked-columns/7941/1 "2012-10-11T17:04:00Z")

</div>

How do I insert into a table after I insert a linked column into it?

e.g.

t:( id:101 102 103 104; v:1.1 2.2 3.3 4.4)

update parent:`t!id?101 101 102 102 from `t

q)t

id &nbsp;v &nbsp; parent

* * *

101 1.1 0

102 2.2 0

103 3.3 1

104 4.4 1

q)`t insert (103;3.2)

'length

q)`t insert (103;3.2;0N)

't

---

<div class="post-metadata">

**Author:** ![Sam11](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@Sam11](https://forum.kx.com/u/Sam11)\
**Post date:** [October 11, 2012, 11:50pm UTC](https://forum.kx.com/t/insert-into-tables-with-linked-columns/7941/2 "2012-10-11T23:50:00Z")

</div>

Thanks. I still can’t figure out how to insert into a table (containing the link) from another table and update the link.  
e.g.  
t1:( c1:`sym?`c`b`a; c2: 10 20 30)

t2:( c3:`sym?`a`b`a`c; c4: 1. 2. 3. 4.)

update t1link:`t1!t1.c1?c3 from `t2

t3:( c3:`sym?`d`e`f`g; c4: 1. 2. 3. 4.)

Now, how do I &nbsp;insert t3 records into t2.

---

<div class="post-metadata">

**Author:** ![Sam11](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@Sam11](https://forum.kx.com/u/Sam11)\
**Post date:** [October 12, 2012, 3:20am UTC](https://forum.kx.com/t/insert-into-tables-with-linked-columns/7941/3 "2012-10-12T03:20:00Z")

</div>

Never mind I figured it out. I can do this -

`t2 insert select c3,c4,t1link:`t1!t1.c1?c3 from t3
