Query editor
WITH filtered_trustlines AS (SELECTaccount_id,asset_code,asset_issuer,deleted,CAST(balance AS DOUBLE) AS balance_num,COALESCE(date(closed_at_date), date(updated_at), date(ingested_at)) AS event_day,COALESCE(last_modified_ledger, ledger_sequence) AS ord_ledgerFROM stellar.trust_linesWHERE asset_issuer = 'GCRYUGD5NVARGXT56XEZI5CIFCQETYHAPQQTHO2O3IQZTHDH4LATMYWC'AND asset_code IS NOT NULLAND asset_code <> 'CETESZ'), active_trustlines AS (SELECT *FROM (SELECT *,ROW_NUMBER() OVER (PARTITION BY account_id, asset_code, asset_issuer, event_day, ord_ledgerORDER BY event_day DESC, ord_ledger DESC) AS rnFROM filtered_trustlines)WHERE rn = 1AND deleted = false)SELECTasset_code,COUNT(DISTINCT account_id) AS current_holder_countFROM active_trustlinesGROUP BY asset_codeORDER BY asset_code;