Query editor
1-- Using current price2SELECT3 sum(l.principal * p.price) as usd4FROM query_3177701 l -- active loans5JOIN prices.usd_latest p6ON l.currency = p.contract_address7ORDER BY 18LIMIT 1
-- Using current price
SELECT
sum(l.principal * p.price) as usd
FROM query_3177701 l -- active loans
JOIN prices.usd_latest p
ON l.currency = p.contract_address
ORDER BY 1
LIMIT 1