Basically what I want is cross product of two tables.
基本上我想要的是两个表的交叉产品。
t1 is :
+------------+
| student |
+------------+
| 1234567890 |
| 1234567890 |
| 1234567890 |
| 000000001 |
+------------+
t2 is:
+--------+
| number |
+--------+
| 1 |
| 3 |
+--------+
How can I get a table which has two columns and 8 entries which are crosss product of values in t1 and t2 ?
如何获得一个包含两列和8个条目的表,它们是t1和t2中值的交叉乘积?
2 个解决方案
#1
4
Select student, number, from t1, t2;
从t1,t2中选择学生,编号;
#2
6
I think you need a CROSS JOIN.
我想你需要一个CROSS JOIN。
It'll join both tables on all rows.
它将在所有行上连接两个表。
SELECT * FROM t1 CROSS JOIN t2
#1
4
Select student, number, from t1, t2;
从t1,t2中选择学生,编号;
#2
6
I think you need a CROSS JOIN.
我想你需要一个CROSS JOIN。
It'll join both tables on all rows.
它将在所有行上连接两个表。
SELECT * FROM t1 CROSS JOIN t2