I have a table that includes the following columns:
UserName (nvarchar), TransactionDateTime (datetime), Balance (money).
Each time a user makes a transaction, this is recorded as a row in the table.
The majority of users have multiple transactions stored in the database.
I want to write an SQL query that takes the most recent TransactionDateTime for each UserName and then creates a total of all these balances.
I do not want to include the balances of any user transactions apart from the most recent for each user.
I hope that I have explained this clearly. Any help is gratefully appreciated.
Using Microsoft SQL Server 2008 and SQL management studio 2008.
Thanks, Nelson