I need to select and then insert tableA's values for each values of tableB. Any suggestions?
So basically the result table will be something like this:
1 | 1
1 | 2
1 | 3
2 | 1
2 | 2
2 | 3
This sounds like a cross join
:
select a.col1, b.col1
from a cross join
b
order by a.col1, b.col1;
You can create a new table using the into
clause. Or create the new table first and use insert into
.
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.