From 54e0b70faaaa87966769378fdebbf926f3309747 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Mon, 27 Jan 2025 13:53:14 -0600 Subject: [PATCH] fix: add select --- src/datastore/pg-store.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/datastore/pg-store.ts b/src/datastore/pg-store.ts index 256642601..7a5062690 100644 --- a/src/datastore/pg-store.ts +++ b/src/datastore/pg-store.ts @@ -2498,8 +2498,9 @@ export class PgStore extends BasePgStore { WHERE pruned = false AND token_transfer_recipient_address = ${principal} ), values AS ( - COALESCE((SELECT total FROM received), 0) AS inbound, - COALESCE((SELECT total FROM sent), 0) + COALESCE((SELECT total FROM sponsored), 0) AS outbound + SELECT + COALESCE((SELECT total FROM received), 0) AS inbound, + COALESCE((SELECT total FROM sent), 0) + COALESCE((SELECT total FROM sponsored), 0) AS outbound ) SELECT inbound, outbound, (inbound - outbound) AS delta `;