CarlOwOsfirst_purchase
    Updated 2022-05-26
    with sales_group_id as(
    select distinct tx_group_id
    from algorand.payment_transaction
    where receiver = 'RANDGVRRYGVKI3WSDG6OGTZQ7MHDLIN5RYKJBABL46K5RQVHUFV3NY5DUE'
    and tx_group_id is not null
    and asset_id = 0
    order by tx_group_id
    ),
    sales as(
    select distinct g.tx_group_id,
    max(amount) as amount
    from sales_group_id g
    join algorand.payment_transaction p on g.tx_group_id = p.tx_group_id
    group by g.tx_group_id
    ),
    daily_sales as(
    select block_timestamp as date, s.tx_group_id, p.tx_id, p.sender, s.amount
    from sales s
    join algorand.payment_transaction p on s.tx_group_id = p.tx_group_id and s.amount = p.amount
    order by date
    ),
    att as(
    select min(date) as date_one, s.sender
    from daily_sales s
    join algorand.asset_transfer_transaction t on s.sender = t.asset_receiver and s.tx_group_id = t.tx_group_id
    where asset_amount is not null
    group by s.sender
    )
    select date(date_one) as date, count(distinct sender) as "Wallets"
    from att
    group by date
    order by date

    Run a query to Download Data