From 4f0493f69effaad7b78e4a0bdcde05e186ae7cc5 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 7 Aug 2023 15:35:10 -0700 Subject: [PATCH] improve sql for top keys --- docs/{sum_credits_used_by_user.sql => top 100 rpc keys.sql} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename docs/{sum_credits_used_by_user.sql => top 100 rpc keys.sql} (72%) diff --git a/docs/sum_credits_used_by_user.sql b/docs/top 100 rpc keys.sql similarity index 72% rename from docs/sum_credits_used_by_user.sql rename to docs/top 100 rpc keys.sql index ab2e69b0..8c6dd21c 100644 --- a/docs/sum_credits_used_by_user.sql +++ b/docs/top 100 rpc keys.sql @@ -1,7 +1,7 @@ -SELECT SUM(`sum_credits_used`) as sum, rpc_accounting_v2.rpc_key_id, rpc_key.user_id, user.email +SELECT SUM(`sum_credits_used`) as sum, rpc_accounting_v2.rpc_key_id, rpc_key.user_id, concat("0x", hex(user.address)) as address, user.email FROM `rpc_accounting_v2` JOIN rpc_key ON rpc_accounting_v2.rpc_key_id=rpc_key.id JOIN user on rpc_key.user_id=user.id GROUP BY `rpc_key_id` ORDER BY sum DESC -LIMIT 100 +LIMIT 100 \ No newline at end of file