To remove duplicate lines from the output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hariny
    New Member
    • Jul 2007
    • 1

    To remove duplicate lines from the output

    Hi,

    Here is my query:
    [code=oracle]
    select a.out_tar||'~'| | a.out_csi_id||' ~'||a.out_cust_ name||'~'||a.ou t_id||'~'||b.ou t_id||'~'||a.ou t_category||'~' ||
    b.out_category| |'~'||
    to_char(a.out_s tart_date, 'fm dd-mon-yyyy hh24:mi') ||'~'||
    to_char(a.out_e nd_date, 'fm dd-mon-yyyy hh24:mi') ||'~'||
    to_char(b.out_s tart_date, 'fmdd-mon-yyyy hh24:mi') ||'~'||
    to_char(b.out_e nd_date, 'fmdd-mon-yyyy hh24:mi')||'~'| |c.ots_inst_lab el from
    out_flat_data_v w a,
    out_flat_data_V w b,
    rca_flat_Data_V w c where
    (a.out_tar=b.ou t_tar)
    and (a.out_tar=c.ot s_tar)
    and (a.out_id!=b.ou t_id)
    and (a.out_type='Un planned')
    and (a.out_csi_id=b .out_csi_id)
    and (a.out_Tar_type ='TAR')
    and (a.out_scope='I ndividual')
    and (a.out_csi_id!= '999999')
    and (b.out_start_da te between a.out_start_Dat e and a.out_end_date)
    and (a.out_start_Da te between '01-jul-07' and '01-aug-07')
    order by a.out_tar
    /
    [/code]

    I am getting an output in this format
    =============== =============== =
    6375486.993~144 65368~MASTER LOCK COMPANY~56599
    6375486.993~144 65368~MASTER LOCK COMPANY~56599
    6381318.993~351 1209~HANOVER COMPRESSOR COMPANY
    6381318.993~351 1209~HANOVER COMPRESSOR COMPANY
    6389647.993~138 73252~SYMMETRIC OM INC~568136~56
    6389647.993~138 73252~SYMMETRIC OM INC~568136~56
    6421248.992~134 87262~EPC BUSINESS~568339 ~56847
    6421248.992~134 87262~EPC BUSINESS~568339 ~56847
    6421248.992~134 87262~EPC BUSINESS~568478 ~56833
    6421248.992~134 87262~EPC BUSINESS~568478 ~56833
    17765296.6~1055 1465~DANOSA~568 790~568879~Cust o
    6423423.992~153 97472~JOHNSON DIVERSEY INC~5688
    6423423.992~153 97472~JOHNSON DIVERSEY INC~5688

    Here most of the rows are duplicate like first 2 rows. Data is same, but output has come twice. How to get only one output?
    Last edited by debasisdas; Jul 24 '07, 09:57 AM. Reason: added code tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You are getting exactly what you have asked for in the query.

    Comment

    • rajanbabu23
      New Member
      • Jul 2007
      • 4

      #3
      Try it....
      [code=oracle]
      select DISTINCT a.out_tar||'~'| | a.out_csi_id||' ~'||a.out_cust_ name||'~'||a.ou t_id| |'~'||b.out_id| |'~'||a.out_cat egory||'~'||
      b.out_category| |'~'||
      to_char(a.out_s tart_date, 'fm dd-mon-yyyy hh24:mi') ||'~'||
      to_char(a.out_e nd_date, 'fm dd-mon-yyyy hh24:mi') ||'~'||
      to_char(b.out_s tart_date, 'fmdd-mon-yyyy hh24:mi') ||'~'||
      to_char(b.out_e nd_date, 'fmdd-mon-yyyy hh24:mi')||'~'| |c.ots_inst_lab el from
      out_flat_data_v w a,
      out_flat_data_V w b,
      rca_flat_Data_V w c where
      (a.out_tar=b.ou t_tar)
      and (a.out_tar=c.ot s_tar)
      and (a.out_id!=b.ou t_id)
      and (a.out_type='Un planned')
      and (a.out_csi_id=b .out_csi_id)
      and (a.out_Tar_type ='TAR')
      and (a.out_scope='I ndividual')
      and (a.out_csi_id!= '999999')
      and (b.out_start_da te between a.out_start_Dat e and a.out_end_date)
      and (a.out_start_Da te between '01-jul-07' and '01-aug-07')
      order by a.out_tar
      /
      [/code]
      Last edited by debasisdas; Jul 24 '07, 10:15 AM. Reason: added code tags

      Comment

      Working...