title: SQL sort based on sum of various columns
body: <p>I have a <strong>MS-SQL</strong> table of game results which contains a home team, home team score, away team, and away team score. I am attempting to query the teams, wins, and losses ordered by first, total wins(descending) and then by total losses(ascending). The table <strong>does not</strong> contain a wins or losses column. Wins and losses must be calculated based on the score. If I need to create a view or temporary table, how do I create that view with teams, wins, and losses?</p>