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 Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Need inputs on DB2 tablespace/table r... ashek15 DB2 3 Sat Mar 24, 2018 11:49 pm
No new posts help to replace columns by rows Vikas Maharnawar DFSORT/ICETOOL 8 Tue Mar 06, 2018 3:27 pm
No new posts COBOL declaration for table Poha Eater DB2 3 Mon Feb 26, 2018 6:58 pm
No new posts load and delete table through JCL wit... ram_vizag JCL & VSAM 9 Thu Feb 01, 2018 12:47 am

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