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 To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am


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