I have two tables (Table 1 and Table 2) and I want to create a table (Table 3) with the ID's. So to speak an to m relationship table.
Table 1
1 Mark
2 George
3 David
Table 2
5 Bank
6 Construction
7 Carfactory
Table 3
1 5
1 6
1 7
2 5
2 6
2 7
3 5
3 6
3 7
I can make it so that the rows from table 1 are taken from 1 to 3 but not as to the row 1 all rows are taken from the table 2. Can anyone help me ?
您可以使用CROSS JOIN实现预期的输出。
SELECT table1.id,table2.id FROM table1 CROSS JOIN table2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.