Most join conditions are based on equality, and so are called equijoins. For example,
SELECT * FROM Departments JOIN Employees ON Departments.DepartmentID = Employees.DepartmentID;
However, you do not have to use equality (=) in a join condition. You can use any search condition, such as conditions containing LIKE, SOUNDEX, BETWEEN, > (greater than), and != (not equal to).
The following example answers the question: For which products has someone ordered more than the quantity in stock?
SELECT DISTINCT Products.Name FROM Products JOIN SalesOrderItems ON Products.ID = SalesOrderItems.ProductID AND SalesOrderItems.Quantity > Products.Quantity;
For more information about search conditions, see Search conditions.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|