Afonso_Diaz2023-05-11 09:48 PM
    Updated 2023-05-11
    with
    t1 as (
    select
    tx_id,
    a.block_timestamp,
    c.attribute_value as user,
    d.attribute_value::int/1e6 as amount_flix
    from osmosis.core.fact_msg_attributes a
    join osmosis.core.fact_msg_attributes b
    using(tx_id)
    join osmosis.core.fact_msg_attributes c
    using(tx_id)
    join osmosis.core.fact_msg_attributes d
    using(tx_id)
    where a.attribute_key = 'stream_id'
    and a.attribute_value = '1'
    and b.attribute_key = 'action'
    and b.attribute_value = 'exit_stream'
    and c.attribute_key = 'sender'
    and c.attribute_index = '1'
    and c.msg_type = 'message'
    and d.attribute_key = 'purchased'
    and d.block_timestamp >= '2023-05-04'
    and d.tx_succeeded = 1
    )

    select
    case
    when amount_flix < 10 then 'Less than 10$FLIX'
    when amount_flix <= 50 then '11$FLIX - 50$FLIX'
    when amount_flix <= 100 then '51$FLIX - 100$FLIX'
    when amount_flix <= 250 then '101$FLIX - 250$FLIX'
    when amount_flix <= 500 then '251$FLIX - 500$FLIX'
    when amount_flix <= 1000 then '501$FLIX - 1000$FLIX'
    when amount_flix <= 5000 then '1001$FLIX - 5000$FLIX'
    when amount_flix <= 10000 then '5001$FLIX - 10,000$FLIX'
    Run a query to Download Data