Replace one column by values of the same column in anther table in SQL server -
i have 2 tables, 1 big , 1 small. both contain columns id
, effectivedate
.
the bigger table has more other columns , of course more rows smaller table.
under condition id
both tables same, effectivedate
column earlier in small table big table. want replace effectivedate
in big table value of effectivedate
column small table.
what should do?
seems very basic sql query....
update bt set effectivedate = st.effectivedate dbo.biggertable bt inner join dbo.smallertable st on bt.id = st.id -- maybe need condition, if not *all* effectivedate values in -- smaller table indeed before values in bigger table st.effectivedate < bt.effectivedate
Comments
Post a Comment