I am new to SQL in general and even newer to MS SQL. I apologize if the title isn’t clear on what I want.
I have two tables an old one that I want to derive data from into a new table. The tables have the exact same columns but different number of rows. The new table has multiple copies of each value in the old table, which only has 2 occurences. see below comparison of two columns: letter and amount.
New table:
A 0
A 0
A 0
B 0
B 0
old table:
A 12
A 0
B 10
B 0
C 23
What I want to achieve is adding the values of the amount column from the old table into just the first occurence of the leter in the new table like so:
A 12
A 0
A 0
B 10
B 0
Inner join causes all the values to be filled ( so all the A’s are set to 12).
try this: