Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us