sql - Aggregating data between two tables in MySQL -


so have 2 tables need aggregate data by.

the first looks this:

zip code | key x          1 x          2 x          3 y          4 y          5 

the second looks this:

characteristics | key                 1 b                 1 c                 1 d                 2 e                 2 f                 3 g                 4 

and need join them this...

zip code | key | characteristics  x          1     x          1     b x          1     c x          2     d x          2     e x          3     f y          4     g ...        ...   ... 

i can't quite think of correct subqueries / joins make happen. appreciated.

try this

select table1.zipcode, table1.key, table2.characteristics table1 inner join table2 on table1.key = table2.key

ok... try this.

select t1.zipcode, t1.keys, t2.character table_1 t1 full outer join table_2 t2 on t1.keys = t2.keys 

Comments