I am a student this is homework… I have one table with four columns: Accounts(numbers), balances(money), and two for descriptions. I have to get a grand total of the balances… This VIEW shows the sums of the balance column but I need to total the sums, also. Any help pointing me in the right direction will be appreciated.
CREATE VIEW [account_balance_sums]
AS
SELECT SUM(balance) AS total,
SUBSTRING(Account,0,2) AS account_group,
FROM COA
GROUP BY account_group
GO
SELECT * FROM [account_balance_sums]
Try totaling them the same way the view creates a total for each account, by using SUM?
(Just don’t
GROUP BY, so that you get a full total instead of just a per-accountgroup total.)Alternatively, you could sum the account totals returned from the view: