I read many similar title related to my issue but I cannot apply for my case. This is my query:
select
d._LINE_NO, a._PROCESS_INST_NO, a._ISSUER, a._ISSUE_DATE,
d._PROCESS_CONTENTS, d._OPT_DIVISION,
b._GOODS_CD, b._GOODS_NAME,b._QTY,
a._Order_No, c._GOODS_CD, c._GOODS_NAME,a._NOTE,
d._LINE_NO + 1 as Proc_Step_No,
count(*) over () as Total_Rows
from
[ENVNDIVDB].[dbo].[TBL_PROC_PH] a
inner join
[ENVNDIVDB].[dbo].[TBL_PROC_PM] b on b._PROCESS_INST_NO = a._PROCESS_INST_NO
inner join
[ENVNDIVDB].[dbo].[TBL_PROC_PMS] c on c._PROCESS_INST_NO = a._PROCESS_INST_NO
inner join
[ENVNDIVDB].[dbo].[TBL_PROC_PN] d on d._PROCESS_INST_NO = a._PROCESS_INST_NO
where
a._PROCESS_INST_NO = '610416'
And here is the result:
It repeated 04 times. (see _PROCESS_CONTENT) And here is the original data of the Process Inst No: 610416
My question is how to eliminate duplicated records
Thanks a lot in advance.