Skip to content

Instantly share code, notes, and snippets.

@mgild
Created April 14, 2025 18:28
Show Gist options
  • Save mgild/4c2c69622b0fd314abead53cc98f1437 to your computer and use it in GitHub Desktop.
Save mgild/4c2c69622b0fd314abead53cc98f1437 to your computer and use it in GitHub Desktop.
WITH signer_lookup AS (
SELECT
tx_id,
MAX(CASE WHEN signed THEN address END) AS signer
FROM account_activity
GROUP BY tx_id
)
SELECT
a.*,
s.signer
FROM
account_activity a
LEFT JOIN
signer_lookup s USING (tx_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment