Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Performence - SELECT

Former Member
0 Kudos

Hi Experts,

I hv SQL code like,

<i><b>1 - SELECT bname

INTO TABLE bname_itab

FROM vbak

WHERE ernam IN s_ernam

AND bname NE space

AND auart IN s_auart

AND vkorg IN s_org

  • and ktokd in s_c_ag

AND vtweg IN s_d_ch

AND spart IN s_div.

2 - SORT bname_itab.

3 - DELETE ADJACENT DUPLICATES FROM bname_itab.</b></i>

So, the 1st statement is, consuming much time, as there 1000's BNAMEs in VBAK.

So,

How to avoide selecting duplicates in the 1st SELECT statement itself?

I mean, only the new/differed BNAMEs shuld b selected!

(so, I dont use 2ns and 3rd stetents any more)

thanq.

1 ACCEPTED SOLUTION

former_member583013
Active Contributor
0 Kudos

SELECT DISTINCT bname
INTO TABLE bname_itab
...

Greetings,

Blag.

2 REPLIES 2

former_member583013
Active Contributor
0 Kudos

SELECT DISTINCT bname
INTO TABLE bname_itab
...

Greetings,

Blag.

Former Member
0 Kudos

Hi srikar,

To read a several entries from the database, use the following:

SELECT [DISTINCT] <cols> ... WHERE ...

If you do not use DISTINCT (<lines> is then empty), the system reads all of the lines that satisfy the WHERE condition. If you use DISTINCT, the system excludes duplicate entries.

The result of the selection is a table. The target area of the INTO clause can be an internal table with a line type appropriate for <cols>. If the target area is not an internal table, but a flat structure, you must include an ENDSELECT statement after the SELECT statement: