SQL Server Allocation of amount in bill
I have the following tables
LINEID BILL Total Amount Allocated Amount
1 1 100
2 1 200
3 2 250
PAYID BILL Paid Amount
1 1 250
2 2 100
I need to allocate the Paid amoount on the first table based on the bill.
I know that I can use the cursor with WHILE loop and allocate - is there a
better way to do this?
Result should be
LINEID BILL Total Amount Allocated Amount
1 1 100 100
2 1 200 150
3 2 250 100
No comments:
Post a Comment