# How to add a сolumn from one table to another?

I have a rather naive question. How does one add a column from an already existing table to another already existing table?

• Using the data given by @bill in his answer below: Table[Insert[table1[[i]], table2[[All,2]][[i]], 3], {i, 3}] (col-2 of table2 becomes col-3 of table1) – user1066 Jun 15 '19 at 19:45

Suppose you want to add the second column from your second table onto the end of the first table. Try this

table1={{a,b,c},{d,e,f},{g,h,i}};
table2={{1,2,3},{4,5,6},{7,8,9}};


which gives you this

{{a, b, c, 2}, {d, e, f, 5}, {g, h, i, 8}}


Look up and study MapThread and Append and All in the help system and see if you can figure out how each piece of this is working.

There are always several different ways of accomplishing anything in Mathematica.

An alternative way to insert a column of table2 (say the last column) as the last column of table1 is to use Join with level specification (third argument) set to 2:

table1 = Array[Subscript[a, Row@{##}] &, {5, 3}];
table2 = Array[Subscript[b, Row@{##}] &, {5, 3}];

col = -1; (* or col = 3 *)
table3 = Join[table1, table2[[All, {col}]], 2];

Row[MapThread[Labeled[MatrixForm @ #, #2, Top] &,
{{table1, table2, table3}, {"table1", "table2", "table3"}}]]


Your question is unclear. When you say "add," do you mean "insert"? Or actually add? If the latter:

Transpose[a][[5]] + Transpose[b][[3]]

will add the 5th column of a to the 3rd column of b.