The format of the variables does not influence the outcome. However ...
There is no way on God's green earth that those data sets combined to produce the output you have shown. Neither data set contains an observation where ID has a missing value. So the combined data set cannot contain such a value.
As a best guess, one data set contains slightly different values than posted. For example, Table2 does not contain an observation with ID=1. Instead, it contains an observation with ID=1.00000000001 and that is rounded to 1 for printing purposes. That wouldn't explain everything about the results you got, but it would explain a lot.
Or perhaps ID is a character variable, and a couple of values in Table2 contain a trailing tab character instead of a trailing blank.
... View more