can anyone help me out with one query?
i have a DB that looks like this:
table expenses
paydate receiver payment
2011-05-06 SOLO 3000
2011-05-08 Walmart 5000
2011-05-09 McDonalds 400
2011-05-08 Korona 700
2011-05-08 Walmart 1000
2011-05-09 BigZ 1300
I have to calculate the sum of all payments in the day when the max payment was done.
the result should look like this:
paydate payment
2011-05-08 6700
i managed to find the max payment and the paydate of it:
SELECT payment, paydate FROM expenses WHERE payment=(SELECT max(payment) FROM expenses);
but it only gives me the max payment and paydate, and i need a sum of the payments on that day.
and query:
result gives us 500 and 2012-04-18, i.e. sum and date
or check this: