Jasper Potts
07/29/2022, 12:41 AM{
"schemaName": "balance",
"dimensionFieldSpecs": [
{
"name": "account_id",
"dataType": "STRING"
},
{
"name": "token_id",
"dataType": "STRING"
},
{
"name": "balance",
"dataType": "LONG"
}
],
"dateTimeFieldSpecs": [
{
"name": "consensus_timestamp",
"dataType": "LONG",
"format": "1:NANOSECONDS:EPOCH",
"granularity": "1:NANOSECONDS"
}
]
}
I am trying to find out the most recent balance for each account_id & token_id pairs. I can't seem to see a easy way to do that without many queries?Kishore G
Jasper Potts
07/29/2022, 12:56 AMJasper Potts
07/29/2022, 12:58 AMselect account_id, token_id, LASTWITHTIME(balance,consensus_timestamp,'long'), max(consensus_timestamp) from balance group by account_id, token_id order by account_id
seems to workKishore G
Kishore G