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
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;
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.