This is MySQL but should work as expected in other databases.
SELECT COUNT(transactions.id) AS transaction_count,
SUM(transactions.amount) AS total,
accounts.name
FROM transactions
LEFT JOIN transaction_journals
ON transactions.transaction_journal_id = transaction_journals.id
LEFT JOIN accounts
ON transactions.account_id = accounts.id
LEFT JOIN transaction_types
ON transaction_journals.transaction_type_id = transaction_types.id
WHERE transaction_journals.date >= "2022-01-01"
AND transaction_journals.date <= "2022-12-31"
AND transaction_types.type = "Withdrawal"
AND amount > 0
GROUP BY accounts.name
ORDER BY transaction_count ASC,
total DESC