Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on finding the duplicate records within the SQL forums, part of the Databases category; Dear all, here i have a small requirement for deletion of duplicate records. I have a table like conntract_id objectid member age 11111111 000000 father 55 11111111 000001 mother 50 ...
|
|||||||
|
|||
|
finding the duplicate records
Dear all,
here i have a small requirement for deletion of duplicate records. I have a table like conntract_id objectid member age 11111111 000000 father 55 11111111 000001 mother 50 11111111 000002 brother 36 11111111 000003 brother 33 11111111 000004 sister 31 11111111 000005 father 55 11111111 000006 sister 31 in the above i need to delete the records which are duplicate member name and if age is same then we have to delete the record. and moreover that is not a PK. i am able to select the the single records using like this. other than these records need to delete. SELECT MEMBER, age FROM azbj_policy_family_rep WHERE contract_id = azbj_pk0_acc.get_contract_id('0110122421') GROUP BY MEMBER, age; please suggest on this, how do i delete the records other than these records. Regards, Venkat |
| Sponsored Links |
|
|||
|
Re: finding the duplicate records
@venkat,
In oracle SQL, The following query will resolves your problem Code:
delete from delete_table where rowid not in (select max(rowid) from delete_table group by MEMBER,AGE ); |
| The Following User Says Thank You to ecearund For This Useful Post: | ||
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Routing duplicate records | mailtos.ravi | Data Warehousing | 1 | 05-29-2009 10:10 AM |
| Target Table Duplicate records count | Sant_parkash | Data Warehousing | 4 | 05-26-2009 03:39 AM |
| Delete duplicate records without using "rowid" | Geek_Guest | SQL | 15 | 01-22-2009 06:49 AM |
| Delete duplicate record | raghvendra_rai | SQL Server | 15 | 03-20-2008 11:29 PM |
| I want load the duplicate records to seperate table | Geek_Guest | Data Warehousing | 4 | 04-06-2007 03:10 AM |