Please help to achieve below resulting table. I tried joining 3 tables, somehow not getting required result.
Table A
ID  Type    Value1  Value2
1   X       100     200
1   Y       200     300
2   X       100     200
Table B
ID  Name
1   P
2   Q 
3   R
4   S
Unique ids from table A with matching values
Desired Result
ID  Name    x_Value1    x_value2    y_value1    y_value2
1   P       100         200         200         300
2   Q       100         200         0           0
 
    