IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to remove the duplicates rows from a DB2 Table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top