例如: 这是table_1
bmw
benz
honda
这是table_2
blue
red
brown
预计是table_3
cars colour
---- -----
bmw blue
benz red
honda brown
答案 0 :(得分:0)
如果你真的想这样做,你需要发明一些加入专栏。变量可以用于:
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;
演示:http://sqlfiddle.com/#!9/b7d46/7
注意:这似乎是一项没有实际价值的奇怪任务。