Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Home arrow Tips and Tricks arrow ABAP Reports arrow SELECT distinct usage!!!
SELECT distinct usage!!! PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Anon.   
Friday, 09 March 2007
The DISTINCT addition to the SELECT statement allows you to remove duplicates from a set of results during a SELECT.

DON'T 

    SELECT DISTINCT MATNR
           FROM MARC
           INTO TABLE T_MARC
           WHERE DISMM = 'ND'.
    
Disadvantages:

  • Requires sorting on database server and adversely affects overall system performance if no index can be used
  • When using DISTINCT the database is always accessed directly by passing the SAP buffer

DO    

Alternative approach:
    SELECT MATNR
           FROM MARC
           INTO TABLE T_MARC
           WHERE DISMM = 'ND'.
    SORT T_MARC BY MATNR.
    DELETE ADJACENT DUPLICATES FROM T_MATNR COMPARING MATNR.
    
Recommendation:

  • Only use the DISTINCT addition if there are a large number of duplicates and the set of results will be significantly reduced if you remove duplicates.
  • Use DISTINCT if the selected fields are part of DB index picked by WHERE clause of the SELECT.

 


Related Items:

 
< Prev   Next >

Google Search

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor