It seems to me that you want to combine two tables in the order of the rows in each table. I'm sorry, but SQL has no concept of implicit row order inside a table, and there is no way in SQL to concatenate columns from two (or more) tables without any column to allow JOIN.
The closest things you can do in SQL:
CROSS JOIN between two tables. This would repeat every row from table1 to every row of table2:
SELECT t1.row1, t1.row2, t2.row3, t2.row4 FROM table1 t1 CROSS JOIN table1 t2
- Create another (auxiliary) column and keep the "order" of your rows in each table (there are many ways to do this using cursors, sequences, ...). Then use these columns to build the
OUTER JOIN :
SELECT t1.auxOrder1, t1.row1, t1.row2, t2.auxOrder2, t2.row3, t2.row4 FROM table1 t1 LEFT OUTER JOIN table1 t2 ON (t1.auxOrder1 = t2.auxOrder2)
By the way, why did you create columns with names such as "row1", "row2"? If it is not intended, I think it can be confusing.
source share