vincent99Q5 Add Paramter to Choose Time Period
Updated 2023-11-29
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
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH FidenzaSales AS (
SELECT
s.TOKENID,
s.PRICE AS Price_ETH,
s.PRICE_USD AS Price_USD,
s.BLOCK_TIMESTAMP,
m.TOKEN_NAME
FROM
ethereum.nft.ez_nft_sales s
JOIN ethereum.nft.dim_nft_metadata m ON s.TOKENID = m.TOKEN_ID
WHERE
m.TOKEN_NAME LIKE '%fidenza%'
and s.BLOCK_TIMESTAMP BETWEEN '{{DateStart}}'
AND '{{DateEnd}}'
),
EarliestSales AS (
SELECT
TOKENID,
MIN(BLOCK_TIMESTAMP) AS EarliestSaleTimestamp
FROM
FidenzaSales
GROUP BY
TOKENID
),
SecondarySales AS (
SELECT
fs.TOKENID,
fs.Price_ETH,
fs.Price_USD
FROM
FidenzaSales fs
LEFT JOIN EarliestSales es ON fs.TOKENID = es.TOKENID
WHERE
fs.BLOCK_TIMESTAMP > es.EarliestSaleTimestamp
)
SELECT
Run a query to Download Data