For example, let’s say I have the following two tables:
Table1:
Id
----
1
2
Table2:
Month
------
Jan
Feb
And I want to combine them using an SQL query to form the following output:
Id Month
---- -------
1 Jan
1 Feb
2 Jan
2 Feb
Is there a way to do this using a single query?
The correct answer is “cross join”:
There is no “on” clause for a cross join. You can do the same thing just using a comma, but this is ancient (and hopefully one day deprecated) SQL syntax. The cross join is the right way to go.