[Solved] how to join two different tables in mysql,with no fields common? [closed]


If you really want to do this, you need to invent some sort of joining column. Variables can be used for that:

select q1.name as car, q2.name as colour 
from
  (select @row := @row + 1 as r, name from car, (select @row := 0) q) q1
inner join
  (select @row2 := @row2 + 1 as r, name from colour, (select @row2 := 0) q) q2
on q1.r = q2.r;

demo: http://sqlfiddle.com/#!9/b7d46/7

Note: this seems like a strange task that has no real value.

1

solved how to join two different tables in mysql,with no fields common? [closed]