Query Issue | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Query Issue

What does the following query mean? select * from table1 join table2 on 1=1
The expression "1=1" is always true, so there are no column values that are being matched like in a regular join – all rows are deemed to match. This is also known as a Cartesian product. If table1 has 5 rows, and table2 has 7 rows, then the query returns 5*7=35 rows. The query is effectively the same as
(1) SELECT * FROM table1, table2
(2) SELECT * FROM table1 CROSS JOIN table2

Thanks a lot