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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -