I'm not sure why you would do this, normally you have a link between tables, so it makes sense what you're joining together.
If you don't have an id on the columns, I guess your best bet would be to give them a rownumber, and use that as an Id.
-- Create table to hold first values
CREATE TABLE #randomfirsttable
(
number INT
)
-- Create table to hold second values
CREATE TABLE #randomsecondtable
(
number INT
)
-- Fill
INSERT INTO #randomfirsttable
VALUES (1),
(2),
(3),
(4),
(5)
-- Fill
INSERT INTO #randomsecondtable
VALUES (6),
(7),
(8),
(9),
(10)
-- Giving the tables an Id by using row number, you can change the order by by whatever you want to order to give it some meaning.
SELECT FirstTable.number,SecondTable.number
FROM (SELECT Row_number()
OVER(
ORDER BY number ASC) Id,
number
FROM #randomfirsttable) FirstTable
INNER JOIN (SELECT Row_number()
OVER(
ORDER BY number ASC) Id,
number
FROM #randomsecondtable) SecondTable
ON FirstTable.id = SecondTable.id
(1, 4), (2, 5)
instead of(1, 5), (2, 4)
, just because of the physical position of the rows?