0

podrian ayudarme, no se me ocurre como eliminar los registros duplicados de esta consulta:

SELECT DISTINCT 
       VendorName
     , Vendor
     , Reference
     , DocumentNumber
     , ClearingDocument
     , DocumentDate
     , ClearingDate
     , '' AS 'TDP'
     , '' AS 'SAP'
     , DocumentCurrency
     , 0 AS 'WF'
     , CASE
           WHEN DocumentCurrency = 'MXN' THEN AmountInDocCurr
       ELSE 0
       END as 'MXN'
     , CASE
           WHEN DocumentCurrency = 'USD' THEN AmountInDocCurr
       ELSE 0
       END as 'USD'
     , AmountInDocCurr
     , Round(VATAmount / 0.16, 2) AS 'Base16'
     , Round(NetAmount - Round(VATAmount / 0.16, 2), 2) AS 'Base0'
     , 0 AS 'Base8'
     , 0 AS 'Exento'
     , Round(VATAmount, 2) AS 'IVA16'
     , 0 AS 'IVA8'
     , WithholdingTaxAmnt AS 'IVARet'
     , 0 AS 'ISRRet'
     , AmountInDocCurr AS 'TotalFactura'
     , CASE
           WHEN DocumentCurrency = 'USD' THEN dbo.sp_getTCTypes3
                                              ( ClearingDate )
       ELSE 1
       END as 'TC'
     , TextField
       FROM Tbl_MXInvoices
       WHERE Month(ClearingDate) = 8 AND Year(ClearingDate) = 2021;
2
  • 1
    Mira Cómo preguntar para que tu pregunta sea mejor recibida. También, aprovecha y haz el recorrido de bienvenida para entender mejor cómo funcionamos y de paso obtener tu primera medalla! duplicados basados en que?
    – gbianchi
    Commented el 31 dic. 2021 a las 4:47
  • podrías intentar agregar la liga a un sqlfiddle así podemos reproducir el problema Commented el 31 dic. 2021 a las 4:47

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.