Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to remove the duplicates rows from a DB2 Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Shaikshavali
Warnings : 1

New User


Joined: 18 Jun 2005
Posts: 22
Location: chennai

PostPosted: Tue Jun 28, 2005 4:46 pm    Post subject: How to remove the duplicates rows from a DB2 Table
Reply with quote

HOW TO RETRIEVE DUPLICATE ROWS FRROM A PARTICULAR TABLE
Back to top
View user's profile Send private message

Shaikshavali
Warnings : 1

New User


Joined: 18 Jun 2005
Posts: 22
Location: chennai

PostPosted: Tue Jun 28, 2005 4:48 pm    Post subject: REMOVE DUPLICATES
Reply with quote

HOW TO REMOVE(NOT ELEMINATING) DUPLICATES FROM A TABLE USING SINGLE QUERY
Back to top
View user's profile Send private message
jagadish2005

New User


Joined: 08 Mar 2005
Posts: 20

PostPosted: Tue Jun 28, 2005 9:47 pm    Post subject: HOW TO RETRIEVE DUPLICATE ROWS FRROM A PARTICULAR TABLE
Reply with quote

Hi,

try this query

Select * from tablename group by columnname having count(columnname) > 1

with regards
Arunachalla
Back to top
View user's profile Send private message
bimalpattanayak

New User


Joined: 08 Apr 2005
Posts: 3

PostPosted: Thu Jun 30, 2005 2:32 pm    Post subject:
Reply with quote

select distinct (*) form tablenamewill solve your prob
Back to top
View user's profile Send private message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Fri Sep 30, 2005 5:03 pm    Post subject: Re: How to remove the duplicates rows from a DB2 Table
Reply with quote

Hi Shaikshavali

By using a single query we cant eliminate duplicate rows i thnk

But u can use this subquery to delete duplicate rows

delete from table name where
salary in
(select salary from tablename
group by salary having count(*) > 1)


I thnk it vll work. but it vll delete all duplicate rows.
Corrections are welcome..


Karthi G.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us