Query editor
WITH current_data AS (SELECTevt_block_time AS last_update,subject,supply AS outstanding_shares,POWER(TRY_CAST(supply AS DOUBLE), 2) / 16000 AS current_price,total_rank,(TRY_CAST(total_rank AS REAL) / TRY_CAST(number_of_people AS REAL) * 100) AS percentile,number_of_peopleFROM (SELECTevt_block_time,subject,supply,RANK() OVER (ORDER BY supply DESC) AS total_rank,number_of_peopleFROM (SELECTevt_block_time,subject,supplyFROM friendtech_base.FriendtechSharesV1_evt_Trade AS bINNER JOIN (SELECTsubject AS max_subject,MAX(evt_block_time) AS max_evtFROM friendtech_base.FriendtechSharesV1_evt_TradeGROUP BY1) AS max_tableON b.evt_block_time = max_table.max_evt AND b.subject = max_table.max_subjectORDER BYsupply DESC)LEFT JOIN (SELECTCOUNT(DISTINCT subject) AS number_of_peopleFROM friendtech_base.FriendtechSharesV1_evt_Trade)ON 1 = 1))SELECTlast_update,twitterusername,twittername,cd.subject as "地址",total_rank AS "排名",current_price AS "当前价格",outstanding_shares AS "流通量"FROM current_data AS cdLEFT JOIN dune."hildobby".dataset_friendtech_profiles AS up --dune_upload.friendtech_usersON cd.subject = up.addressorder by total_rank asc