Link to home
Start Free TrialLog in
Avatar of oak29
oak29

asked on

Looping through a table and adding a column

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.
Table X
   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.  
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oak29
oak29

ASKER

Thanks!  Wow, that was a lot easier than I made it out to be.