I have data, let's take a sample;
Currency | Account | FiatValue |
---|---|---|
BTC | Account1 | 10 |
ETH | Account2 | 6 |
BTC | Account2 | 10 |
Is there any way I can use a view
to aggregate this in some way. I'd like to end up with an aggregate view of all Accounts
and their total FiatValue
across all Currencies. I was thinking of writing some PowerShell
to grab the data in this table, and update a new table via a script, but thought possibly I can achieve something similar within SQL?
Goal
Account | FiatValue |
---|---|
Account1 | 10 |
Account2 | 16 |
CodePudding user response:
If you can write a SQL query, you can save it as a View. This one is very simple:
create or alter view AccountSummary
as
select AccountId, sum(FiatValue) FiatValue
from Account
group by AccountId