Skip to content

Commit

Permalink
fix: address balance view query
Browse files Browse the repository at this point in the history
  • Loading branch information
satran004 committed Mar 6, 2024
1 parent 6a11337 commit 715bf5b
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ create table address_tx_amount

-- address_balance_view
drop view if exists address_balance_view;
create view address_balance_view AS
select ab.*
from address_balance ab
inner join (select address, MAX(slot) as max_slot
from address_balance ab2
group by address) max_ab on ab.address = max_ab.address and ab.slot = max_ab.max_slot;
CREATE VIEW address_balance_view AS
SELECT ab.*
FROM address_balance ab
INNER JOIN (SELECT address, unit, MAX(slot) AS max_slot
FROM address_balance ab2
GROUP BY address, unit) max_ab
ON ab.address = max_ab.address AND ab.unit = max_ab.unit AND ab.slot = max_ab.max_slot;

-- stake_address_balance_view
drop view if exists stake_address_balance_view;
Expand Down

0 comments on commit 715bf5b

Please sign in to comment.