Reputation: 31
I have DB2 and I have the following Query
SELECT t1.MyName, t2.MySalary
FROM Employee t1 CROSS JOIN Salary t2
I got the following Exception :
An unexpected token "CROSS" was found following "me FROM "Employee" t1 ". Expected tokens may include: "".. SQLCODE=-104, SQLSTATE=42601
Upvotes: 0
Views: 4344
Reputation: 1
SELECT t1.MyName, t2.MySalary
FROM Employee t1 Join Salary t2 on 1=1
The ON clause includes a condition that is always true to force the Cartesian join to occur.
Upvotes: 0
Reputation: 51445
If I understand correctly, a cross join is the Cartesian product of the two tables.
Try this query:
SELECT t1.MyName, t2.MySalary
FROM Employee t1, Salary t2
Upvotes: 4