Home » SQL & PL/SQL » SQL & PL/SQL » Remove duplicate and leave max
Remove duplicate and leave max [message #36685] Wed, 12 December 2001 10:20 Go to next message
Messages: 9
Registered: November 2001
Junior Member
Hi, All,
I have a table have
a,b,c field,

a,b should be unique, and leave max(c) row in.
How can I delete other rows?

Re: Remove duplicate and leave max [message #36686 is a reply to message #36685] Wed, 12 December 2001 11:45 Go to previous message
Messages: 13
Registered: December 2001
Junior Member
delete from 'table'
where (a,b,c) not in (select a,b,max(c) from 'table' group by a,b);

Previous Topic: Advanced sorting
Next Topic: multiline updates
Goto Forum:

Current Time: Sat May 25 03:25:46 CDT 2024