I can't figure out why my output is duplicating, but I'm sure it is incorrect joins. I'm new to SQL in general, so this may be an inefficent query.
SELECT a.id, a.number, a.number2, b.id, b.number3, b.number4, c.id, c.score, (a.number - b.number3) as a_b_difference, (a.number2 - b.number4) as a_b_difference3 FROM file a
INNER JOIN file b on a.id = b.id
INNER JOIN file c on a.id = c.id
I want to subtract the two fields and combine all three files on the id. However, my result populates with repeating data.
This is a sample of what I am getting: