Show TOC Start of Content Area

Syntax documentation Query Specification  Locate the document in its SAP Library structure

 The query specification represents the result of a complex database query. The most common SELECT statements are just query specifications.

Syntax

This graphic is explained in the accompanying text

<query specification> ::=
    SELECT ( DISTINCT | ALL )?
        <select list> <from clause>
          <where clause> )? ( <group by clause> )?

            <having clause> )?.

 

The result of a <query specification> is constructed as follows:

...

       1.      The <from clause> is evaluated.

       2.      If a <where clause> is specified, the result is filtered by applying the <search condition> of the <where clause>. The new result has the same degree as the previous result.

       3.      If a <group by clause> is specified, the specified grouping is performed on the result. The new result has the same degree as the previous result.

       4.      If a <having clause> is specified, the result is filtered by applying the <search condition> of the <having clause>. The new result has the same degree as the previous result.

       5.      The <value expression>s in the <select list> is calculated. The new result is a table that has the degree and the <display name>s of the <select list>.

       6.      If DISTINCT is specified, all duplicate rows from the result are filtered. Else the result remains unchanged. (Specifying ALL has no effect.)

 

DISTINCT may be specified only once in a <query specification>.

More Information

Select List

FROM Clause

WHERE Clause

GROUP BY Clause

HAVING Clause

End of Content Area