Versão atual:

Select sem dados repetidos

Rapaziada bom dia! tenho o seguinte select:

SELECT distinct *
  FROM TR_MAINTENANCE_REPORT_PROD TRMRPR
  LEFT OUTER JOIN TR_MAINTENANCE_REPORT TRMREP
    ON ((TRMREP.ID_MAINTENANCE_REPORT = TRMRPR.M_REP_ID))
  LEFT OUTER JOIN TR_MAINT_REP_PROD_ANALYSIS TRMRPA
    ON ((TRMRPA.M_REP_PROD_ID = TRMRPR.ID_M_REP_PROD))
  LEFT OUTER JOIN TR_TROUBLE_TYPE TTBTP
    ON ((TTBTP.ID_TROUBLE_TYPE = TRMRPA.TROUBLE_TYPE_ID))
  LEFT OUTER JOIN TR_CUSTOMER TCUSTMR
    ON ((TCUSTMR.ID_CUSTOMER = TRMREP.CUSTOMER_ID))
  LEFT OUTER JOIN TR_P_O_MAN_PROD_LOT_DTL TPOLPD
    ON ((TPOLPD.IDENTIFY_CODE = TRMRPR.PROD_IDENTIFIER_CODE))
  LEFT OUTER JOIN TR_P_O_MANAGE_LOT_PROD TRPOLP
    ON ((TRPOLP.ID_P_O_MANAGE_LOT_PROD = TPOLPD.P_O_MANAGE_LOT_PROD_ID))
  LEFT OUTER JOIN TR_P_O_MANAGE_LOT_COM TRPOLC
    ON ((TRPOLC.ID_P_O_MANAGE_LOT_COM = TRPOLP.ATTACHED_LOT_COM_ID))
  LEFT OUTER JOIN TR_ACTION TACT
    ON ((TACT.ID_ACTION = TRMRPR.ACTION_ID))
  LEFT OUTER JOIN TR_MAINTENANCE_LEVEL TMAINLEV
    ON ((TMAINLEV.ID_MAINT_LEVEL = TRMRPR.MAINT_LEVEL_ID))
  LEFT OUTER JOIN TR_TROUBLE_CLASS TTRCLASS
    ON ((TTRCLASS.ID_TR_CLASS = TRMRPA.TROUBLE_CLASS_ID))
  LEFT OUTER JOIN TR_TROUBLE_ORIGIN TTRORIN
    ON ((TTRORIN.ID_TROUBLE_ORIGIN = TRMRPA.TROUBLE_ORIGIN_ID))
  LEFT OUTER JOIN TR_SEGMENT TRSEG
    ON ((TRSEG.ID_SEGMENT = TCUSTMR.SEGMENT_ID))
  LEFT OUTER JOIN TR_PRODUCT TPROD
    ON ((TPROD.ID_PRODUCT = TRMRPR.PRODUCT_ID))
  LEFT OUTER JOIN TR_FIRMWARE TFWARE
    ON ((TFWARE.ID_FIRMWARE = TRMRPR.FIRMWARE_ID))
  LEFT OUTER JOIN TR_BUDGET TRBDG
    ON ((TRBDG.M_REP_ID = TRMREP.ID_MAINTENANCE_REPORT))
 WHERE (TRMREP.DT_INVOICE BETWEEN to_date ('01/05/2009', 'dd/MM/yyyy') AND to_date ('21/08/2015','dd/MM/yyyy') AND TRMRPR.RMA_CODE = '20112' AND
       TRMREP.ID_MAINTENANCE_REPORT = TRMREP.ID_MAINTENANCE_REPORT AND
       TRMRPR.RMA_CODE = TRMRPR.RMA_CODE AND
       TRMRPA.ID_MRP_ANALYSIS = TRMRPA.ID_MRP_ANALYSIS AND
       TPOLPD.IDENTIFY_CODE = TPOLPD.IDENTIFY_CODE AND
       TPOLPD.OLD_ID_P_DTL IS NULL)

Tenho um problema nele... Ele me traz alguns dados repetidos.

VEJAM NA IMAGEM ABAIXO

https://www.filepicker.io/api/file/2osih7FiTaEjYxUAJjoO

Vi que o mesmo identify code possui dois id diferentes.

Eu gostaria de trazer somente 1 dos identify_code.

Tem como fazer isso?

Obrigado!!!!!

Versão(1):

Ver a versão formatada

Select sem dados repetidos

Comentário

new question