SELECT

Reference

Syntax

SELECT { { SINGLE [FOR UPDATE] }
       | { [DISTINCT] { }      } }
       { *
       | { {col1|aggregate( [DISTINCT] col1 )} [AS a1]
           {col2|aggregate( [DISTINCT] col2 )} [AS a2]  ... }
       | (column_syntax) }
       FROM { { {dbtab [AS tabalias]}
              | { [(] {dbtab_left [AS tabalias_left]} | join
                      {[INNER] JOIN}|{LEFT [OUTER] JOIN}
                      {dbtab_right [AS tabalias_right] ON join_cond} [)]}
              | (dbtab_syntax) [AS tabalias] }
              [UP TO n ROWS]
              [CLIENT SPECIFIED]
              [BYPASSING BUFFER] }
       { { INTO {[CORRESPONDING FIELDS OF] wa}|(dobj1, dobj2, ...) }
       | { INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab
                          [PACKAGE SIZE n] } }
       [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
       [GROUP BY {col1 col2 ...}|(column_syntax)]
       [HAVING sql_cond]
       [ORDER BY { {PRIMARY KEY}
                 |{{{col1|a1} [ASCENDING|DESCENDING]}
                   {{col2|a2} [ASCENDING|DESCENDING]}
                   ... }
                 | (column_syntax) }].
  ...
[ENDSELECT.].


Effect

This statement reads data from one or multiple database tables into data objects. If the result set is not assigned in one step, a loop is opened which is closed using ENDSELECT. This loop provides the results in the target fields.

Additions

Specification of the rows:

Specification of the columns:

Specification of the database table(s):

Specification of the target area:

Specification of a condition:

Specification of a grouping:

Specification of a sorting: