SQL stored proceedure to sum detail records and update a master record
Posted on 2008-10-14
I have a table with transaction details in it. I've also got a table with a master record in it that contains a field for original amount and amount remaining.. I would like to write a stored procedure that will sum the detail records, subtract them from the original amount, and update the master record.
Below is a sample of what I'd like the two tables to look like. Any help would be appreciated.
BLOCKID ORIGAMT REMAMT
1 50 20
2 50 43