Posts: 2,536
Location: Western Maryland
|
Use the DATEDIFF mysql function. Give this a try:
SELECT * FROM for_sale WHERE DATEDIFF(today(), ListDate) <= 7 ORDER BY ListDate Desc
DATEDIFF always substracts the second term from the first, so be sure you always put the later date (in this case, today()), as the first term otherwise the logic will be off as the result would be a negative number.
On a tangent: That, too, could be solved using some function to determine the absolute value -- but again, the above call should work for you (although I have no means to test it where I am).
__________________
—Kyrnt
|