Subqueries that can return only one or zero rows to the outer statement are called single-row subqueries. Single-row subqueries can be used anywhere in a SQL statement, with or without a comparison operator.
For example, a single-row subquery can be used in an expression in the SELECT clause:
SELECT (select FIRST T.x FROM T) + 1 as ITEM_1, 2 as ITEM_2,... |
Alternatively, a single-row subquery can be used in an expression in the SELECT clause with a comparison operator.
For example:
SELECT IF (select FIRST T.x FROM T) >= 10 THEN 1 ELSE 0 ENDIF as ITEM_1, 2 as ITEM_2,... |
Subqueries that can return more than one row (but only one column) to the outer statement are called multiple-row subqueries. Multiple-row subqueries are subqueries used with an IN, ANY, ALL, or EXISTS clause.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |