SELECT
cd.id AS `Client ID`,
CONCAT(cd.firstname,' ',cd.lastname) AS `Client`,
hb_currency(SUM(t.`in`),cb.currency_id) AS `Total Income`
FROM hb_client_details cd
JOIN hb_client_billing cb ON (cb.client_id=cd.id)
JOIN hb_transactions t ON (t.client_id=cd.id)
GROUP BY cd.id
ORDER BY SUM(t.`in`) DESC
LIMIT 15