I need to sum a group for my query. Something like:
SELECT customer_id, SUM(weekly) FROM earnings GROUP BY customer_id
The above works, but I need something a bit more complex, and my query is like this:
SELECT
(SELECT SUM(weekly) FROM earnings) +
(SELECT SUM(day_earnings) FROM earnings) / .75
The above makes the sum of all the earnings, weekly and daily, but I need to group them by customer_id like in the first example. How do I achieve this?