I am having a hell of a time figuring this one out.
I have a database that I enter dollar amounts on certain days and not others. And sometimes multiple dollar amounts are recorded for the same day.
Database looks something like this:
SDate | Time | Amount
08-02-28 | 14:00:00 | $55
08-03-01 | 09:00:00 | $30
08-03-02 | 11:00:00 | $75
08-03-02 | 20:00:00 | $20
08-03-05 | 15:00:00 | $50
08-03-06 | 18:15:00 | $40
08-03-06 | 12:00:00 | $15
08-03-08 | 15:30:00 | $65
08-03-09 | 10:30:00 | $10
08-03-09 | 16:00:00 | $20
08-03-12 | 19:00:00 | $45
08-03-15 | 11:30:00 | $20
08-03-16 | 21:30:00 | $25
Currently I query the last 7 days sum with something like:
SELECT SUM(amount) as net7d FROM data WHERE DATE(SDATE) > DATE(curdate() -7);
But what I really want is to check the last 7 days of activity and total those. Is there an easy way to do this in one query?
Thanks for answer or any guidance/ideas in this direction.:eek:
Ron R. Jr.