How to join two result sets in MySQL? -
i want join 2 different result sets in mysql displayed side by. example lets have result set #1 follow -
name phone abc 123 def 456 ghi 789
result set # 2 -
mail id website jkl@jkl.com www.jkl.com mno@mno.com www.mno.com pqr@pqr.com www.pqr.com
now want these 2 result displayed side side in single result set without relation.
name phone mail id website abc 123 jkl@jkl.com www.jkl.com def 456 mno@mno.com www.mno.com ghi 789 pqr@pqr.com www.pqr.com
how should it?
you need join between 2 tables don't have id. well, can't this. tables in sql not ordered, need keys link them.
you can something. and, if lucky, work. following adds row number each table , joins on that:
select t1.name, t1.phone, t2.mail, t2.website (select t1.*, @r1 r1, @r1 := @r1 + 1 t1 cross join (select @r1 := 0) ) r1 join (select t2.*, @r2 r2, @r1 := @r2 + 1 t2 cross join (select @r2 := 0) ) r2 on t1.r1 = t2.r2
i must emphasize not guaranteed work. need proper join key between tables. however, might work.