有个办法可以实现这个效果,不过我不太建议这样来做,更建议咱们在数据表里面去添加两表的关联字段去处理
因为下面的实现方式也是利用SQL生成一个序号,然后根据序号进行关联
- select * from
- (SELECT A,B,C,(@row_a:= @row_a + 1) as row_num
- FROM a,(SELECT @row_a:= 0) AS a1) t1
-
- LEFT JOIN
- (SELECT D,E,(@row_b := @row_b + 1) as row_num
- FROM b, (SELECT @row_b := 0) AS b1) t2
- ON t1.row_num=t2.row_num
复制代码
|