Contents Index Joined tables Joining more than two tables

ASA SQL User's Guide
  Joins: Retrieving Data from Several Tables
    Joins overview

Joining two tables


To understand how a simple inner join is computed, consider the following query. It answers the question: which product sizes have been ordered in the same quantity as the quantity in stock?

SELECT DISTINCT name, size,
    sales_order_items.quantity
FROM product JOIN sales_order_items
ON product.id = sales_order_items.prod_id
  AND product.quantity = sales_order_items.quantity
name size quantity
Baseball Cap One size fits all 12
Visor One size fits all 36

You can interpret the query as follows. Note that this is a conceptual explanation of the processing of this query, used to illustrate the semantics of a query involving a join. It does not represent how Adaptive Server Anywhere actually computes the result set.

For a description of how outer joins are computed, see Outer joins.


Contents Index Joined tables Joining more than two tables