i'm trying export multiple mysql tables single csv file, these tables have different number of columns , have nothing in common. example below:
table1:
id| name 1 | ted 2 | marry null| null table2:
married| age | phone y | 35 | no n | 25 | yes y | 45 | no the result want is:
id| name | married | age | phone 1 | ted | y | 35 | no 2 | marry | n | 25 | yes null| null | y | 45 | no is possible using mysql commands? have tried types of join doesn't give me result need.
try query:
select * (select @n1:=@n1+1 'index', table1.* table1, (select @n1:=0)t)t1 natural join (select @n2:=@n2+1 'index', table2.* table2, (select @n2:=0)t1)t2 ; you can see in this fiddle working example.
in example generate index column table1 , table2 , natural join 2 tables.
this way join done using row position returned select of tables without order operator , this not idea!
Comments
Post a Comment