sql - In SQLite how to insert a new column into s table with values of a column in another table? -


in sqlite have 2 tables, t1 , t2. have same number of records. can run following command create new column in t1

alter table t1 add column t2_col; 

suppose t2 has 1 column. how replace t2_col's content t2's row row (by rowid essentially).

use subquery read value corresponding t2 record:

update t1 set t2_col = (select t2_col               t2               t2.rowid = t1.rowid) 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -