SELECT customer.firstName, customer.lastName, customer.emailAddress,SUM(items.count) purchaseCount, ROUND(SUM(product.unitPrice * items.count)) totalSpent FROM purchases UNNEST purchases.lineItems AS items JOIN product ON KEYS items.productJOIN customer ON KEYS purchases.customerId GROUP BY customer ORDER BY totalSpent DESCLIMIT10