<blockquote>
delete from contact
where id in(
select contact1.id from contact contact1 inner join contact contact2
on contact1.userid=contact2.userid and contact1.id>contact2.id;
)
</blockquote>
This is a amazing SQl statement, although it may be simple to you.
You have a table named ''contact'', and the column user have some duplicated record (more than 2). now we decide to delete all duplicate record, just retain the oldest record which has the smallest id. we can make it with the above SQL statement.