Álvaro
Álvaro

Reputation: 1

How to combine two tables in SQL with no relation between each other?

Given two tables: Dim People (which contains all the sales people of the company) and Items (which contains all the items that the company sells).

I would like to combine both tables as follows. Let's say that in Dim People we have 3 rows (Sherin, Alvaro, Emad) and in Items we have 4 (1, 2, 3, 4), I would need to have something like this:

Sherin-1
Sherin-2
Sherin-3
Sherin-4
Alvaro-1
Alvaro-2
Alvaro-3
Alvaro-4
Emad-1
Emad-2
Emad-3
Emad-4

How would build the query to return this result?

Thanks in advance!

Didn't even know what to do because I've never combined two tables that have no connection between each other. I expect something like above.

Upvotes: 0

Views: 59

Answers (1)

Dimi
Dimi

Reputation: 472

You can try cross join here:

SELECT *
FROM People, Items

Or explicitly:

SELECT *
FROM People
CROSS JOIN Items

Upvotes: 1

Related Questions