我有两张桌子:
表1:
myGLobal = 5;
this.myGlobal; // 5
和table2:
+-----+-----+-------+
| ID | num | title |
+-----+-----+-------+
| 101 | 0 | pro |
+-----+-----+-------+
| 102 | 0 | xtr |
+-----+-----+-------+
| 103 | 0 | low |
+-----+-----+-------+
| 104 | 0 | hi |
+-----+-----+-------+
我需要mysql请求填写表3,如:
+-----+--------+
| Nn | title |
+-----+--------+
| 1 | ttl1 |
+-----+--------+
| 2 | ttl2 |
+-----+--------+
| 3 | ttl3 |
+-----+--------+
即。对于来自+-----+-----+
| ID | Nn |
+-----+-----+
| 101 | 1 |
+-----+-----+
| 101 | 2 |
+-----+-----+
| 101 | 3 |
+-----+-----+
| 102 | 1 |
+-----+-----+
| 102 | 2 |
+-----+-----+
| 102 | 3 |
+-----+-----+
| 103 | 1 |
+-----+-----+
| 103 | 2 |
+-----+-----+
| 103 | 3 |
...
的每个ID
,我需要table1
中的所有Nn
。
我编写了以下sql请求,效果很好,但我需要sql请求才能使用JOIN语句,我该怎么做?
table2
答案 0 :(得分:2)
使用cross join:
INSERT INTO `table3` ( `ID`, `Nn` )
SELECT `t1`.`ID`, `t2`.`Nn`
FROM `table1` as `t1` CROSS JOIN `table2` as `t2`;
答案 1 :(得分:0)
试试这个:
Elements divs = doc.select("div[specific-tag]");