Hi,
I have a table called Loan and have columns with percentage and amount. Eg :
ID Percentage Amount
1 10 10000
2 10 10000
3 15 15000
4 10 10000
The total loan approved for customer is 25%.
So I want to write a query to only display the lines from the table where percentage sum till reached 25%. The query should return ID 1 2 and 3 only. How to do it?
I write until this but return error :
Declare @PurchaserLoanAmount Integer = 25
Select Percentage, Amount
From Loan
Where Sum(StagePercentage) <= @PurchaserLoanAmount
Order By Stage