join three identical tables in mySQL -


i have 3 tables same columns different number of rows (different each time).

   table         table b      table c    (narows)       (nbrows)      (ncrows)   --------       ---------     ---------- id name v1 v2  id name v1 v2  id name v1 v2 

i want create table records (max of na,nb,nc) without dublicates

     result of query  ------------------------------------------------------------- a.id    a.name    a.v1     a.v2     b.v1    b.v2     c.v1 c.v2 

i try joins without success. please me !

this query

select      a.id,      a.name,     a.v1 a_v1,     ...     b.v1 b_v1,      ...     c.v1 c_v1,      ...     table_a a,     table_b b,     table_c c     a.id = b.id     , b.id = c.id 

will give result:

---------------------------------------------------------- a.id   a.name   a_v1   a_v2   b_v1   b_v2   c_v1   c_v2 

(you can name resultset like)

assertion: every id exists in every table (otherwise can use joins or union).


Comments