Skip to Content
0
Jun 14, 2021 at 01:45 PM

duplicate record / registro duplicado

80 Views

Good morning, I hope you can help me, I am making a query to the ORCT received payment tables related to the RCT3 table and others because in my report I want to know the different types of payments it has and the total of all the payment, to know The total of the payment I take the field of total of the document, but it happens to me that if among the different payments I have an example, I have two payments with cards or a check, it brings me the record two or more times in the report. What can I do? / Buenos días, espero me puedan ayudar, estoy haciendo una consulta a las tablas de pagos recibidos ORCT relacionada con la tabla RCT3 y otras más porque en mi reporte quiero saber los diferentes tipos de pagos que tiene y el total de todo del pago, para conocer el total del pago tomo el campo de total del documento, pero me ocurre que si entre los distintos pagos tengo ejemplo tengo dos pagos con tarjetas o cheque me trae en el reporte dos o más veces el registro ¿Qué puedo hacer?

SELECT T0."DocNum", T0."DocDate", T0."CardCode", T0."CardName", T0."CounterRef",T0."CashSum", T0."CheckSum", T0."TrsfrSum", T0."CreditSum", T3."CreateDate", T3."CreateTime", T3."UpdateDate", T3."UpdateTime", T0."TrsfrDate", T0."DocTotal", T0."TransId", T0."TaxDate", T0."PayMth", T2."FolioNum", T2."DocNum", T2."FolioPref", T0."U_EIPY_NRCA",T2."Series", T3."U_EIPY_USUA", T3."U_EIPY_ESTA",T2."DocDueDate", T0."CreditSum", T0."CheckSum", T0."TrsfrSum", T4."CreditCard", T0."CashSum",T0."U_EIPY_ESTA", T3."CreateDate", T3."UpdateDate", T1."SumApplied"

FROM

ORCT T0

LEFT JOIN RCT2 T1 ON T0."DocEntry" = T1."DocNum"

INNER JOIN OINV T2 ON T1."DocTransId" = T2."TransId"

LEFT JOIN "@EIPY_APCA" T3 ON T0."U_EIPY_NRCA" = T3."U_EIPY_NRCA"

LEFT JOIN RCT3 T4 ON T0."DocEntry" = T4."DocNum"

WHERE T0."U_EIPY_NRCA" = '22'order by T0."CounterRef" ;