Hi @gholamreza rezaie ,
As Olaf said, the LAST function is not a built-in function of SQL Server,it is only supported in MS Access.In SQL Server, the LAST function can be replaced by the method mentioned by Erland.
Applied to your code should look like this:
SELECT TOP 1 Fee FROM i
LEFT JOIN r
ON r.condition=i.condition
ORDER BY [DATE] DESC;
If you have any question, please feel free to let me know.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.