AArete's client analytics reporting workflow needs a smoother view of daily revenue from active client accounts. Write a PostgreSQL query that aggregates eligible transactions and calculates a rolling three-day average.
revenue_transactions to client_accounts and include only accounts with account_status = 'active'.| Column | Type | Description |
|---|---|---|
| account_idPK | INTEGER | Unique client account identifier |
| account_name | VARCHAR(100) | Client account name |
| account_status | VARCHAR(20) | Current account status |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique revenue transaction identifier |
| account_id | INTEGER | Client account associated with the transaction |
| revenue_date | DATE | Date on which revenue was recorded |
| revenue_amount | NUMERIC(12,2) | Revenue amount for the transaction |