SocioCryptoUntitled Query
Updated 2022-10-13Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
›
⌄
SELECT a.*, b.price as last_price, b.price_usd as last_price_usd
FROM
(SELECT tokenid,
count(DISTINCT tx_hash) as n_sales,
avg(price_usd) as avg_price_usd,
avg(price) as avg_price
FROM ethereum.core.ez_nft_sales
WHERE nft_address = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'
GROUP by
tokenid) a
LEFT JOIN (
SELECT tokenid,
price,price_usd, rank
FROM(
SELECT *,
rank()over(partition by tokenid ORDER BY block_timestamp DESC) as rank
FROM ethereum.core.ez_nft_sales
WHERE nft_address = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d'
)
WHERE rank = 1
) b
ON a.tokenid = b.tokenid
Run a query to Download Data