i need to take first row value and check it each row's value column if any one is greater then subtract that value and add that row into another table.
rowNo name value ID
1 a 10 1
2 a 5 2
3 a 20 3
4 a 50 4
this is the table
we need to take the 10 first and compare it with other rows
and if value is greater subtract it