Getting the right range of dates.....
Posted: Fri Nov 15, 2002 5:39 pm
hey all, I'm trying to get a report that compares this weeks order totals with last weeks order totals...
I have this query for this week:
that gives me all orders from now to seven days ago.. .what I need is from 8 days ago to 14 days ago.
I'm not sure after read the docs how to subtract time and compare the dates. Anyone? thanks
I have this query for this week:
Code: Select all
<?php
SELECT sum(orders_total) as total, count(orders_id) as ordnum FROM orders WHERE TO_DAYS(NOW()) - TO_DAYS(orders_date) <= 7
?>I'm not sure after read the docs how to subtract time and compare the dates. Anyone? thanks