I have 2 tables, 'tab1' and 'tab2':
tab1 is:
col1
25.0
30.0
31.0
25.0
tab2 is:
col1 col2
25.0 11.0
30.0 99.0
31.0 57.0
I want to get the following merged table result by matching the col1 values in tab1 with col1 in tab2 (thus filling in using col2 values from tab2):
col1 col2
25.0 11.0
30.0 99.0
31.0 57.0
25.0 11.0
I am using this sqlite code currently:
INSERT INTO `merged_table1`
SELECT * FROM tab1 LEFT JOIN tab2
ON tab1.col1 = tab2.col1;
However, the result is not correct (giving an extra column):
25 25 11
30 30 99
31 31 57
25 25 11
INSERT INTOmerged_table1` SELECT tab1.col1, tab2.col2 FROM tab1 LEFT JOIN tab2 ON tab1.col1= tab2.col1;`