[英]Updating data based on latest date/time
我有一個包含1周數據的表,但是我需要基於SDT_G字段中的最新日期/時間條目從源表中添加其他數據
因此,例如,如果我的表的最大日期/時間為22/08/2018 23:56:32,我想從源表中插入日期/時間大於該日期/時間的數據。
預先感謝您的任何幫助
這是您的想法嗎?
insert into dest_table (col1, col2, . . .)
select s.col1, s.col2, . . .
from source_table s
where s.datecol > (select max(d.datecol) from dest_table);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.