Duplicate in DB2 table



IBM's flagship relational database management system

Duplicate in DB2 table

Postby sganja » Wed Oct 07, 2015 8:32 pm

Hi All.
I am having data in DB2 table as in below format where duplicate records got inserted with just change in Microseconds of LAST_UPDT_TS.
Name       EMPno   status_code    LAST_UPDT_TS
AAAAAA    111111      AB         2015-09-29-20.58.17.596017
AAAAAA    111111      AB         2015-09-29-20.58.17.598889
BBBBBB    222222      AB         2015-09-29-11.30.14.333321
BBBBBB    222222      AB         2015-09-29-11.30.14.334561
CCCCCC    333333      AB         2015-09-29-08.26.11.222356
CCCCCC    333333      AB         2015-09-29-08.26.11.244444


I am trying to pull records which got duplicate entries from the table using below query which is not getting desired results. Could you please suggest what changes needs to be made to query.

Select *
from table
where
   A.Name=B.name and
   A.EMPNo=B.EMPno and
   Date(A.LAST_UPDT_TS) = Date(B.LAST_UPDT_TS) and
   Time(A.LAST_UPDT_TS) = Time(B.LAST_UPDT_TS)
with ur;


Thanks in advance.
sganja
 
Posts: 13
Joined: Wed Feb 06, 2013 8:58 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Duplicate in DB2 table

 

Re: Duplicate in DB2 table

Postby NicC » Thu Oct 08, 2015 4:12 pm

In future please use the code tags to present your code/data. You used quote tags which do not preserve spacing.

What do you mean by 'desired results'? What were your results, what were your 'desired results'?
How abut defining A and B in your query?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Duplicate in DB2 table

Postby sganja » Fri Oct 09, 2015 11:06 am

Sure NicC. From next time will take care. As of now i am able to resolve my query and get it executed.
sganja
 
Posts: 13
Joined: Wed Feb 06, 2013 8:58 pm
Has thanked: 1 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post