Consider my query,
Select EmpId,RemainingBalance from Salary where EmpId='15'
My results pane,
15 450.00
15 350.00
15 250.00
How to get last RemainingBalance amount (ie) 250.00
...
Consider my query,
Select EmpId,RemainingBalance from Salary where EmpId='15'
My results pane,
15 450.00
15 350.00
15 250.00
How to get last RemainingBalance amount (ie) 250.00
...
Presumably you have a datetime in the table that can be used to determine which is the latest record, so you can use this:
SELECT TOP 1 EmpId, RemainingBalance
FROM Salary
WHERE EmpId = '15'
ORDER BY SomeDateTimeField DESC
If you don't have such a datetime field that indicates when a record was created, then you need another field that can be used to imply the same (e.g. an IDENTITY field, where the greater the number, the more recent the record) - approach would be the same as above.