ton*_*nyf 4 sql plsql oracle10g
我有以下带有重复信息的示例数据:
ID Date Emp_ID Name Keep
---------------------------------------------------------
1 17/11/2010 13:45:22 101 AB *
2 17/11/2010 13:44:10 101 AB
3 17/11/2010 12:45:22 102 SF *
4 17/11/2010 12:44:10 102 SF
5 17/11/2010 11:45:22 103 RD *
6 17/11/2010 11:44:10 103 RD
Run Code Online (Sandbox Code Playgroud)
根据上述数据集,如何删除重复的Emp ID,而仅保留指定了最大日期/时间的Emp ID?
因此,根据以上内容,我只会看到ID:1、3和5。
谢谢。
就像是:
从the_table_with_no_name删除
在哪里date_column!=(SELECT MAX(t2.date_column)
从the_table_with_no_name t2
在哪里t2.id = the_table_with_no_name.id);