• I hope you are on the ORACLE platform seeing the DDL

    FROM a SQL Server Point of view

    If you created these table like these

    CREATE TABLE eventhistory (

    Event_id int not null,

    Event_Description varchar(100),

    Update_time datetime not null)

    CREATE TABLE currentevents (

    Event_id int not null,

    Event_Description varchar(100))

    Since varchar2 is not available in sql server I have used varchar and instead of DATE I have used DATETIME since the former will not have a time part

    My question is How will you know your current event_description is outdated in current_tables. If you have just a single event in current_tables then it is not applicable.

    update currentevents

    set

    Event_Description=dt.Event_Description

    from (select event_id, event_description from eventhistory where Update_time=(select MAX(Update_time) from eventhistory))DT

    inner join eventhistory e on e.Event_id=dt.Event_id

    where e.Event_id=DT.Event_id

    The derived table gets the event last updated (DT)and update the currentevents table. Jeff also shown the same using Common Table expression

    (CTE)

    If a currentevents also have DATE column to know if its is outdated from eventhistory, you can adjust the query to update all events with a 'where' condition

    where currenteventUpdate_time<Update_time