Wednesday 3 January 2018

SELECT DISTINCT


SELECT DISTINCT : is a SQL Select query, which is used to get the unique entries of the fields in the select statement.
It will not allow any duplicate entry into the internal table.


In the below example we are having a selection screen where we are defining a selection range of Material number by select option.
At first we are fetching the records with normal select statement and we find Multiple records from the database.







Now with the similar selection range we use select distinct statement and we are getting only one records.
This is because we have selected only the material number in select statement with distinct clause. Now distinct will not allow any duplicate entry of material number.





Notes: Whenever it's possible avoid SELECT DISTINCT, instead select data into internal table, sort and use DELETE ADJACENT DUPLICATES for performance wise.

No comments:

Post a Comment

In this post we use some basics Events  and Control Break Statements for Generating Classical Report Based On single Table. If You want so...