sql - Deleting Duplicate Records in Oracle based on Maximum Date/Time -


i have following sample data duplicate information:

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         

based on above data set, how can remove duplicate emp ids , keep emp ids have maximum date/time specified?

so based on above, see ids: 1, 3 , 5.

thanks.

something like:

delete 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);

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -