I have one table as follows which has data only for 2011 and 2012:
country year value1
ABCD 2011 x1
ABCD 2012 x2
PQRS 2011 x3
PQRS 2012 x4
and another table as follows which has data for years from 2010 to 2014:
country year value2
ABCD 2010 y1
ABCD 2011 y2
ABCD 2012 y3
ABCD 2013 y4
ABCD 2014 y5
PQRS 2010 y6
PQRS 2011 y7
PQRS 2012 y8
PQRS 2013 y9
PQRS 2014 y10
I want a combined table as follows:
country year value2 value1
ABCD 2010 y1 null
ABCD 2011 y2 x1
ABCD 2012 y3 x2
ABCD 2013 y4 null
ABCD 2014 y5 null
PQRS 2010 y6 null
PQRS 2011 y7 x3
PQRS 2012 y8 x4
PQRS 2013 y9 null
PQRS 2014 y10 null
Can anybody suggest a way? I both the cases primary key is (country+year). Also if many such tables are there what might be the solution?
Thanks.