The NATURAL JOIN operator can cause problems by equating columns you may not intend to be equated. For example, the following query generates unwanted results:
SELECT * FROM SalesOrders NATURAL JOIN Customers; |
The result of this query has no rows. SQL Anywhere internally generates the following ON clause:
FROM SalesOrders JOIN Customers ON SalesOrders.ID = Customers.ID |
The ID column in the SalesOrders table is an ID number for the order. The ID column in the Customers table is an ID number for the customer. None of them match. Of course, even if a match were found, it would be a meaningless one.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |