Geeks Talk

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.

finding the duplicate records

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 ...

Go Back   Geeks Talk > Databases > SQL
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 09-08-2009
Junior Member
 
Join Date: Sep 2009
Location: Punre
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
venkat kareedu is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-08-2009
Contributing Member
 
Join Date: Dec 2008
Location: bangalore
Posts: 76
Thanks: 0
Thanked 18 Times in 18 Posts
ecearund is on a distinguished road
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 );
Reply With Quote
The Following User Says Thank You to ecearund For This Useful Post:
  #3 (permalink)  
Old 09-08-2009
Junior Member
 
Join Date: Sep 2009
Location: Punre
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
venkat kareedu is on a distinguished road
Re: finding the duplicate records

Thanks Alot,
Reply With Quote
Reply

  Geeks Talk > Databases > SQL

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


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


All times are GMT -4. The time now is 02:14 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved