Skip to content
Advertisement

How to join two unrelated table in MySQL?

I have two unrelated tables and I need to join in a single row as expected output below. I tried below query and doesn’t work. How to make join these tables??

Table 1

Table 2

Expected Output:

I have tried this query

Advertisement

Answer

where the all rows sub query works out the allocates a row number to the max possible number of rows which is then used later to join to the row numbers allocated to table1 and table2. NOTE there is nothing to order by so the results are not ordered..

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement