Refresh my memory. I can’t recall how to join tuples (a,b) and (c) to produce (a,b)*(c). For example:
n
---
0
1
2
And
site_id value
----------- -------------
1 a
1 b
2 c
I’d like to end up with:
site_id value n
----------- -------------- --
1 a 0
1 a 1
1 a 2
1 b 0
1 b 1
1 b 2
2 c 0
2 c 1
2 c 2
How can I achieve this?
That’s called a CROSS JOIN, also known as the Cartesian product.
You can also do it without the JOIN keyword just by using a comma:
Here’s full test code you can use to verify that it works:
Results: