Looping through a table and adding a column
Posted on 2009-04-30
I need some assistance with the sql to accomplish the desired outcome.
Here is an example of what the data could look like in the table.
L_ID C_ID Indem
32566 54345 25.00
32566 54346 26.00
32566 54346 37.00
32566 54347 45.00
I will be writing this data to another table. What I will be doing is taking everthing from the specified table X with the same L_ID and inserting it into another table. The one thing that will change is that I need to add the Indem column when the C_ID is equal to another C_ID. So with that said the C_ID with 54346 will need to have their Indem values added together and inserted into table Y.