Аналогично, но в разы быстрее будет так:
SELECT
"ticker_symbol" AS symbol,
count(case when "request_status" = :requestStatus then 1 else null end) "pendingCount",
sum(case when "request_status" = :requestStatus then "amount" else null end)::varchar "expected"
FROM "requests"
WHERE "wallet_address" = :walletAddress
GROUP BY "ticker_symbol"
Если я ниего не напутал.
А если нулевые значения не нужны, то можно еще проще:
SELECT
"ticker_symbol" AS symbol,
count(*) "pendingCount",
sum("amount")::varchar "expected"
FROM "requests"
WHERE "wallet_address" = :walletAddress and "request_status" = :requestStatus
GROUP BY "ticker_symbol"