开发者

SQL join two tables without keys/relations

I have two tables, one of them has weeks of year, and the second table has categories开发者_开发问答. I need to create a table that contains each week and each category, but there's no fields/keys that intersect in two tables:

Table 1:

week1
week2
week3
week4

Table 2:

Cat1
Cat2

Resulting table:

week1 cat1
week1 cat2
week2 cat1
week2 cat2
...
week4 cat1
week4 cat2

I'd like to do this without using many cursors/looping.


SELECT * FROM Table1 CROSS JOIN Table2

This will get you every combination of all columns from Table1 and Table2.


Have you tried just

 SELECT * FROM table1, table2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜