Please help how to code this on with SQL server database

Generic answer: Iterate over the table shown and total up what you want then display as you wish.

There are thousands of discussions about picking up what's in that table so that can't be the issue or block.