sql_cond - subquery
... ( SELECT result
[GROUP BY group] [HAVING group_cond] ) ...
A subquery is a
SELECT statement in parenthesis in which all additions except
INTO, and ORDER
BY can be used. A subquery with a single-column resulting set, in other words, the specification
columns in the
result of the subquery is limited to one column or to an
aggregate expression, is known as a scalar subquery.
A subquery can be used within the following logical expressions
sql_cond of the
WHERE conditions for a subquery:
Subqueries can be nested by using subqueries in the
WHERE conditions of a
subquery. In nested subqueries, the columns specified in the
are searched inside out, though the columns of inner subqueries conceal columns with the same name in outer subqueries.
A subquery that uses columns from the surrounding
SELECT statement in its
WHERE condition, is known as a correlated subquery. It must be possible to
assign the column uniquely to a database table or view in the surrounding
statement. A correlated subquery is evaluated for each individual line of the resulting set in the surrounding
A maximum of 10
SELECT statements are permitted within one ABAP statement,
in other words the
SELECT itself and a maximum of 9 other subqueries. This
restriction is independent of whether the subqueries are nested or occur in different logical expressions of the
- With a correlated subquery, a projection view cannot be accessed in the surrounding
- If a subquery is used, the Open SQL statement bypasses SAP buffering.