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, SalesOrderItems.Quantity FROM Products JOIN SalesOrderItems ON Products.ID = SalesOrderItems.ProductID AND Products.Quantity = SalesOrderItems.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 SQL Anywhere actually computes the result set.
Products.ID = SalesOrderItems.ProductID
).
Products.Quantity = SalesOrderItems.Quantity
).
For a description of how outer joins are computed, see Outer joins.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |