sql - insert column from one table into another -
i have 2 tables: set1 , searchinfo. this:
set1 searchid | position 3 1 1 7 3 4 searchinfo searchid | searchdate 1 6 2 8 3 9
i want add column searchdate set1 , use searchid key. have tried:
alter table set1 add column searchdate1 datetime; insert set1 (searchdate1) select b.searchdate set1 left outer join searchinfo b on a.searchid=b.searchid;
however,
set1 searchid | position | searchdate1 3 1 1 7 3 4 x x x
as oppose :
set1 searchid | position | searchdate1 3 1 9 1 7 6 3 4 9
what want : update column have made. not need insert anything
update set1 set searchdate = si.searchdate set1 s inner join searchinfo si s.searchid = si.searchid
Comments
Post a Comment