What is CROSS JOIN syntax
When writing queries with CROSS JOIN, consider the following guidelines:
- There is no matching of rows performed, and so no ON clause is used. (It is an error to use an ON clause with CROSS JOIN.)
- To use ANSI SQL-92 syntax, separate the input table names with the CROSS JOIN operator.
The following query is an example of using CROSS JOIN to create all combinations of employees and products:
SQLCopy
SELECT emp.FirstName, prd.Name
FROM HR.Employee AS emp
CROSS JOIN Production.Product AS prd;