SELECT customers.*, top_10.total FROM (SELECT customer_id, SUM(top_amount) AS total FROM purchases GROUP BY customer_id LIMIT 0, 10) AS top_10, customers WHERE customers.id = top_10.customer_id ORDER BY top_10.total DESC