Skip to content

Instantly share code, notes, and snippets.

@garethtdavies
Created October 15, 2021 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garethtdavies/dc59372f8100de1a5012a581a3fbedda to your computer and use it in GitHub Desktop.
Save garethtdavies/dc59372f8100de1a5012a581a3fbedda to your computer and use it in GitHub Desktop.
Get the last 100 MINA transactions
SELECT transactions.amount,
transactions.fee,
transactions.`from`,
transactions.`to`,
transactions.`hash`,
transactions.id,
transactions.isdelegation,
transactions.memo,
transactions.nonce,
transactions.`datetime`,
transactions.blockstatehash,
transactions.blockheight
FROM (
SELECT transactions.amount,
transactions.fee,
transactions.`from`,
transactions.`to`,
transactions.`hash`,
transactions.id,
transactions.isdelegation,
transactions.memo,
transactions.nonce,
transactions.`datetime`,
transactions.blockstatehash,
transactions.blockheight
FROM minaexplorer.archive.transactions
WHERE `to` = 'B62qk9WYHu2PBYv4EyEubnVQURcwpiV2ysuYYoMdwi8YTnwZQ7H4bLM'
AND canonical = true
AND failurereason is Null
UNION ALL
SELECT transactions.amount,
transactions.fee,
transactions.`from`,
transactions.`to`,
transactions.`hash`,
transactions.id,
transactions.isdelegation,
transactions.memo,
transactions.nonce,
transactions.`datetime`,
transactions.blockstatehash,
transactions.blockheight
FROM minaexplorer.archive.transactions
WHERE `from` = 'B62qk9WYHu2PBYv4EyEubnVQURcwpiV2ysuYYoMdwi8YTnwZQ7H4bLM'
AND canonical = true
AND failurereason is Null
) transactions
ORDER BY datetime DESC,
nonce DESC
LIMIT 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment