How to avoid duplicates for an result set

how to avoid the duplicate rows for the below query
SELECT  to_char(grecode (titleid)) gre_code, to_char(toeflcode (titleid)) toefl_code,titleid
          FROM (SELECT DISTINCT TO_CHAR
                                   (UPPER (TRIM (get_clob_value (table_name,
                                                                 KEY
                                   ) RESULT,
                                titleid
                           FROM mcp_specifications a JOIN mcp_title_specifications b
                                ON a.specificationid = b.specificationid
                                JOIN mcp_titles c ON b.titleid = c.titleid
                          WHERE b.is_parent = 'F'
                            AND UPPER (TRIM (c.university_state)) =
                                                          UPPER (TRIM ('USA'))
                            AND TO_CHAR (get_clob_value (table_name, KEY)) IS NOT NULL
                            AND UPPER (TRIM (SPECIFICATION)) IN
                                                   (UPPER (TRIM ('program'))))
         WHERE UPPER (TRIM (RESULT)) = UPPER (TRIM ('COMPUTER SCIENCE'))
      ORDER BY RESULT ASC;the output of the query would be
gre_code    toefl_code   titleid
402             78             5518
402             78             5519
402             78             5520
402             78             5521the output should be
402 78 any titleid

Some simplified code:
SELECT grecode(titleid) gre_code,
       toeflcode(titleid) toefl_code,
       min(titleid) titleid
FROM   (SELECT DISTINCT TO_CHAR(UPPER(TRIM(get_clob_value(table_name,KEY)))) RESULT,
               titleid
        FROM   mcp_specifications a
               JOIN mcp_title_specifications b
                    ON a.specificationid = b.specificationid
               JOIN mcp_titles c
                    ON b.titleid = c.titleid
        WHERE  b.is_parent = 'F'
        AND    UPPER(TRIM(c.university_state)) = 'USA'
        AND    TO_CHAR (get_clob_value (table_name, KEY)) IS NOT NULL
        AND    UPPER(TRIM(SPECIFICATION)) = 'PROGRAM')
WHERE  UPPER(TRIM(RESULT)) = 'COMPUTER SCIENCE'
GROUP BY grecode(titleid),
         toeflcode(titleid)Please note that applying functions like UPPER and TRIM on a string literal can and should be avoided.
For example:
UPPER(TRIM('USA')) = 'USA'Why force the database to do both an UPPER and a TRIM on something that can just be represented in uppercase with no surrounding spaces? It's a waste of time.

Similar Messages

  • How to avoid duplicate posting of noted items for advance payment requests?

    How to avoid duplicate posting of noted items for advace payments request?

    Puttasiddappa,
    In the PS module, we allow the deletion of a component pruchase requisition allthough a purchase order exists. The system will send message CN707 "<i>A purchase order already exists for purchase requisition &</i>" as an Iinformation message by design to allow flexible project management.
    If you, however, desire the message CN707 to be of type E you have to
    modify the standard coding. Doing so, using SE91, you can invoke the
    where-used-list of message 707 in message class CN, and to change the
      i707(cn)
    to
      e707(cn)
    where desired.
    Also, user exit CNEX0039 provides the possibility to reject the
    deletion of a component according to customers needs e. g. you may
    check here whether a purchase order exists and reject the deletion.
    Hope this helps!
    Best regards
    Martina Modolell

  • How should i use the two results sets in one single report data region?

    Hi frnz,
     I have to create a report using the below condition...
    Here my given data  set query gives you the two result sets ,so how should i use that two result sets information in single report....when i accessing that data set query it will take the values off the first result set not for the second result set.
    without using sub report and look up functionality..... if possible
    is there any way to achieve this.....Please let me know..
    Thanks!

    You cant get both resultsets in SSRS. SSRS dataset will only take the first resultset
    you need to either create them as separate queries or merge them into a single resultset and return with ad additional hardcoded field which indicates resultset (ie resultset1,resultset2 etc)
    Then inside SSRS report you can filter on the field to fetch individual resultsets at required places. While merging you need to make sure metadata of two resultsets are made consistent ie number of columns and correcponding column data types should be same.
    In absence of required number of columns just put some placeholders using NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to avoid duplicates values from alvgird see below code

    how to avoid duplicates values from alvgird see below code
    in below query docno no is repeated again and again
    how i can avoid duplication in this query.
    select * into corresponding fields of table itab
             from  J_1IEXCHDR
                     inner join  J_1IEXCDTL
                        on  J_1IEXCDTLlifnr =  J_1IEXCHDRlifnr
                     where  J_1IEXCHDr~status = 'P'.

    Hi Laxman,
    after that select statement
    select * into corresponding fields of table itab
    from J_1IEXCHDR
    inner join J_1IEXCDTL
    on J_1IEXCDTLlifnr = J_1IEXCHDRlifnr
    where J_1IEXCHDr~status = 'P'.
    <b>if sy-subrc = 0.
    delete adjucent duplicates from itab comparing <field name of itab internal table>
    endif.</b>
    this will delete your duplicate entries.once you done with this call the alv FM.
    <b>  call function 'REUSE_ALV_GRID_DISPLAY'</b>
    exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'IT_USER_COMMAND'
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       i_grid_title                      = 'Purchase Order Details'
      I_GRID_SETTINGS                   = I_GRID_SETTINGS
       is_layout                         = wa_layout
       it_fieldcat                       = it_fieldcat
      IT_EXCLUDING                      = IT_EXCLUDING
      IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
       it_sort                           = it_sort
      IT_FILTER                         = IT_FILTER
      IS_SEL_HIDE                       = IS_SEL_HIDE
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        = IS_VARIANT
       it_events                         = it_event
      IT_EVENT_EXIT                     = IT_EVENT_EXIT
      IS_PRINT                          = IS_PRINT
      IS_REPREP_ID                      = IS_REPREP_ID
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
      IT_HYPERLINK                      = IT_HYPERLINK
      IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
      IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
      IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
      ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
        tables
    <b>      t_outtab                          = ITAB</b>
    exceptions
       program_error                     = 1
       others                            = 2
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Thanks
    Vikranth Khimavath

  • How to avoid Duplicate Records  while joining two tables

    Hi,
    I am trying to join three tables, basically two tables are same one is like history table, so I wrote a query like
    select
    e.id,
    e.seqNo,
    e.name,
    d.resDate,
    d.details
    from employees e,
    ((select * from dept)union(select * from dept_hist)) d
    join on d.id=e.id and e.seqno=d.seqno
    but this returing duplicate records.
    Could anyone please tell me how to avoid duplicate records of this query.

    Actually it is like if the record is processed it will be moved to hist table, so both table will not have same records and I need the record from both the tables so i have done the union of both the tables, so d will have the union of both records.
    But I am getting duplicate records if even I am distinct.

  • How to avoid duplicate data while inserting from sample.dat file to table

    Hi Guys,
    We have issue with duplicate data in flat file while loading data from sample.dat file to table. How to avoid duplicate data in control file.
    Can any one help me on this.
    Thanks in advance!
    Regards,
    LKR

    No, a control file will not remove duplicate data.
    You would be better to use an external table and then remove duplicate data using SQL as you query the data to insert it to your destination table.

  • How to set collapsespecification to avoid duplicates in Search Results

    can someone help me How to set collapsespecification to avoid duplicates in OOTB Search Results page.
    Suresh Kumar Udatha.

    Export the content search webpart you will download the .webpart file  you will find the below property
    <property name="DataProviderJSON" type="string">{"QueryGroupName":"Default","QueryPropertiesTemplateUrl":"sitesearch://webroot","IgnoreQueryPropertiesTemplateUrl":false,"SourceID":"8413cd39-2156-4e00-b54d-11efd9abdb89","SourceName":"Local SharePoint Results","SourceLevel":"Ssa","CollapseSpecification":"","QueryTemplate":"(contentclass:STS_ListItem OR IsDocument:True)","FallbackSort":[{"d":1,"p":"ViewsLifeTime"}],"FallbackSortJson":"[{\"d\":1,\"p\":\"ViewsLifeTime\"}]","RankRules":null,"RankRulesJson":"null","AsynchronousResultRetrieval":false,"SendContentBeforeQuery":true,"BatchClientQuery":true,"FallbackLanguage":-1,"FallbackRankingModelID":"","EnableStemming":true,"EnablePhonetic":false,"EnableNicknames":false,"EnableInterleaving":false,"EnableQueryRules":true,"EnableOrderingHitHighlightedProperty":false,"HitHighlightedMultivaluePropertyLimit":-1,"IgnoreContextualScope":true,"ScopeResultsToCurrentSite":false,"TrimDuplicates":false,"Properties":{"TryCache":true,"Scope":"{Site.URL}","ListId":"dd8de50c-d533-4667-9cad-79e4402d5435","ListItemId":1,"UpdateLinksForCatalogItems":true,"EnableStacking":true},"PropertiesJson":"{\"TryCache\":true,\"Scope\":\"{Site.URL}\",\"ListId\":\"dd8de50c-d533-4667-9cad-79e4402d5435\",\"ListItemId\":1,\"UpdateLinksForCatalogItems\":true,\"EnableStacking\":true}","ClientType":"ContentSearchRegular","UpdateAjaxNavigate":true,"SummaryLength":180,"DesiredSnippetLength":90,"PersonalizedQuery":false,"FallbackRefinementFilters":null,"IgnoreStaleServerQuery":false,"RenderTemplateId":"DefaultDataProvider","AlternateErrorMessage":null,"Title":""}</property>
    update the collapse specification value (currently empty string) then upload the webpart 
    Hope that helps|Amr Fouad|MCTS,MCPD sharePoint 2010

  • How to avoid 'duplicate data record' error message when loading master data

    Dear Experts
    We have a custom extractor on table CSKS called ZCOSTCENTER_ATTR. The settings of this datasource are the same as the settings of 0COSTCENTER_ATTR. The problem is that when loading to BW it seems that validity (DATEFROM and DATETO) is not taken into account. If there is a cost center with several entries having different validity, I get this duplicate data record error. There is no error when loading 0COSTCENTER_ATTR.
    Enhancing 0COSTCENTER_ATTR to have one datasource instead of two is not an option.
    I know that you can set ignore duplicates in the infopackage, but that is not a nice solution. 0COSTCENTER_ATTR can run without this!
    Is there a trick you know to tell the system that the date fields are also part of the key??
    Thank you for your help
    Peter

    Alessandro - ZCOSTCENTER_ATTR is loading 0COSTCENTER, just like 0COSTCENTER_ATTR.
    Siggi - I don't have the error message described in the note.
    "There are duplicates of the data record 2 & with the key 'NO010000122077 &' for characteristic 0COSTCENTER &."
    In PSA the records are marked red with the same message (MSG no 191).
    As you see the key does not contain the date when the record is valid. How do I add it? How is it working for 0COSTCENTER_ATTR with the same records? Is it done on the R/3 or on the BW side?
    Thanks
    Peter

  • How to avoid duplicate BOM Item Numbers?

    Hello,
    is there a way to avoid duplicate BOM Item Numbers (STPO-POSNR) within one BOM?
    For Routings I could avoid duplicate Operation/Activity Numbers with transaction OP46 by setting T412-FLG_CHK = 'X' for Task List Check. Is there an aquivalent for BOMs?
    Regards,
    Helmut Gante

    Hello,
    is there a way to avoid duplicate BOM Item Numbers (STPO-POSNR) within one BOM?
    For Routings I could avoid duplicate Operation/Activity Numbers with transaction OP46 by setting T412-FLG_CHK = 'X' for Task List Check. Is there an aquivalent for BOMs?
    Regards,
    Helmut Gante

  • How to avoid duplicate record in a file to file

    Hi Guys,
              Could you please provide a soultion
              in order  to avoid duplicate entries in a flat file based on key field.
              i request in terms of standard functions
             either at message mappingf level or by configuring the file adapter.
    warm regards
    mahesh.

    hi mahesh,
    write module processor for checking the duplicate record in file adapter
    or
    With a JAVA/ABAP mapping u can eliminate the duplicate records
    and check this links
    Re: How to Handle this "Duplicate Records"
    Duplicate records
    Ignoring Duplicate Records--urgent
    Re: Duplicate records frequently occurred
    Re: Reg ODS JUNK DATA
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d0/538f3b294a7f2de10000000a11402f/frameset.htm
    regards
    srinivas

  • How to get previous row of result set in select query?

    I want to access the previous row of an result set obtained yet, in the same selectquery .
    How can I do that?

    Use analytical functions.
    For example:
    create table top_n_test (
       a number,
       b varchar2(10)
    insert into top_n_test values (1,   'one');
    insert into top_n_test values (2,   'two');
    insert into top_n_test values (3, 'three');
    insert into top_n_test values (4,  'four');
    insert into top_n_test values (5,  'five');
    insert into top_n_test values (6,   'six');
    insert into top_n_test values (7, 'seven');
    insert into top_n_test values (8, 'eight');
    insert into top_n_test values (9,  'nine');
    commit;
    select a, b from (
      select
        a,b,
        rank() over (order by b) r
      from
        top_n_test
    where
      r<4;
             A B
             8 eight
             5 five
             4 fourHTH
    Ghulam

  • How to Avoid Duplicate photo Uploads with Elements 11 on Mac?

    I've searched Help for this and it tells me to select a "Do not show duplicates" box in Preferences that doesn't seem to exist with my Mac version.  How do I force Elements 11 to ignore photos I've already uploaded?  Thanks

    I'll have a look at the help before doing further tests:
    http://helpx.adobe.com/content/help/en/elements-organizer/using/cameras-card-readers.html
    About what is specific for Windows in the preference menu:
    (Windows only) To specify default values for automatic downloads, set any of the following:
       http://helpx.adobe.com/content/help/en/elements-organizer/using/
    Begin Download
    Specifies when a download begins after a device is connected.
       http://helpx.adobe.com/content/help/en/elements-organizer/using/
    Create Subfolder(s) Using
    Specifies if and how to separate and name folders containing media files shot on different dates.
       http://helpx.adobe.com/content/help/en/elements-organizer/using/
    Delete Options
    Specifies if and how to delete the original media files from your camera after copying them to your hard disk.
        http://helpx.adobe.com/content/help/en/elements-organizer/using/
    Copy New Files Only (Ignore Already Imported Files)
    Causes the downloader to ignore files that are already on your hard disk.

  • Reg: Removing duplicates in MDM result set Iview.

    Hi All,
    I am using a standard result set iview. Is it possible to remove the duplicates in this iview?
    For eg: If i am displaying names in the result set iview, if the same name comes second time,that should not be considered or displayed on the result set iview.
    Thanks,
    Prasanthi.

    You might get better results asking in a MDM forum....

  • Oracle Coherence implementation for JDBC result set

    Instead of ORM, is Oracle coherence will support for accessing the data using normal JDBC calls?
    If it supports JDBC , what is the CacheStore implemetation for this?
    Can you provide me some example how to cache the JDBC ResultSet values and retrieve back from Cache?

    Hi,
    I think you mix up several concepts.
    user13266701 wrote:
    Instead of ORM, is Oracle coherence will support for accessing the data using normal JDBC calls?At the moment (up to 3.5.x), there is no way to query Coherence via JDBC out-of-the-box. There were a couple of initiatives to provide such features but they were not part of the product, only initiatives in the Incubator, but I believe they have been dropped.
    Upcoming releases may bring replacement, although I don't think it would be outright JDBC compatible, as that would imply converting an object-oriented data to result set so that you can convert it back, so it would in effect waste CPU resources.
    If it supports JDBC , what is the CacheStore implemetation for this?
    CacheStores have nothing to do with how you access the cache itself. Those are internal operations invoked by Coherence itself. Don't look for a relationship between querying the cache and doing anything with the cache store. The only relationship with them is that key-based operations on the cache may lead to operations on the cache store, but whether they do happen or not depends on the cache content, too.
    Can you provide me some example how to cache the JDBC ResultSet values and retrieve back from Cache?If I understand, that is yet a third concept. If you indeed want to cache JDBC ResultSet-s obtained from the database, then I have to disappoint you: it is not directly possible, as the ResultSet object is an abstraction over an open database cursor, and hence it keeps a database resource. Active resources cannot be cached in Coherence. You may acquire a RowSet from the JDBC driver, which would be possible to cache, however it may not be the most efficient thing to do due to possibly not optimal serialization format used by the RowSet to serialize itself.
    So if I did not answer the questions you wanted to ask, would you please explain in more detail what exactly you would like to do?
    Best regards,
    Robert

  • How to avoid duplicates in export?

    Hi
    Is there any way to avoid duplicates when exporting from LR4/avoid exporting the same picture(to the same folder) again?
    Kindly
    Jan

    Rob Cole wrote:
    I stand corrected - thanks Jim .
    I think I had forgotten this because of how I use publish services / collections.
    All of my publish services have exactly one (smart) collection, which defines the photos to be published.
    I don't create a multitude of publish collections in order to define an associated publish tree - the tree is defined by the source folders. I started this convention before Lr was a glimmer in Adobe's eyes (even before digital photography was invented). If I was inventing now from scratch I might do it differently, but this is one reason I get aggravated when some of the experts in this forum continually "forget" that the need to maintain a prescribed convention is sometimes an absolute requirement (or at least *highly* desirable), and Lr should be able to adapt to the convention - and not the other way around.
    If I quit Lr today, I could still maintain published trees without Lr's publishing collections. If your scheme depends on publishing collections which have no visibility outside Lightroom (e.g. a multitude of hard drive publishing collections), then you'd be screwed (so to speak) if you wanted to migrate to another software for maintenance. Not only that, but if you rebuild your catalog, all such collections are lost (unless you know how to use plugins to preserve them). Even if your scheme depends on regular (non-publishing I mean, whether smart of not) collections, and you use jf's Collection Publisher to publish in matching hierarchy, you'd still be screwed when migrating, since those collections do not exist outside Lightroom.
    Impact may vary of course, but I like to minimized dependence on a specific software if possible.
    Folders exist regardless of which software you use to edit your photos. Put another way: collection hierarchies are proprietary, folder structure isn't.
    So, although lots of people prefer jf's Collection Publisher (understandably), it's worth considering jf's Folder Publisher too, or my very own TreeSync Publisher.
    Cheers,
    Rob

Maybe you are looking for