Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » UltraLite - Database Management and Developer Guide » UltraLite SQL reference » UltraLite SQL language elements » Expressions in UltraLite

Subqueries in expressions - UltraLite

A SELECT statement that is nested inside another SELECT statement.


A subquery is structured like a regular query.


In UltraLite, you can only use subquery references in the following situations:

  • As a table expression in the FROM clause. This form of table expression (also called derived tables) must have a derived table name and column names in which values in the SELECT list are fetched.

  • To supply values for the EXISTS, ANY, ALL, and IN search conditions.

You can write subqueries about names that are specified before (to the left of) the subquery, sometimes known as outer references to the left. However, you cannot have references to items within subqueries (sometimes known as inner references).


The following subquery is used to list all product IDs for items that are low in stock (that is, less than 20 items).

FROM SalesOrderItems
   FROM Products
   WHERE Quantity < 20 )