Page 1 of 1

Duplicate in DB2 table

PostPosted: Wed Oct 07, 2015 8:32 pm
by sganja
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.

Re: Duplicate in DB2 table

PostPosted: Thu Oct 08, 2015 4:12 pm
by NicC
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?

Re: Duplicate in DB2 table

PostPosted: Fri Oct 09, 2015 11:06 am
by sganja
Sure NicC. From next time will take care. As of now i am able to resolve my query and get it executed.