Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- SQL / PHP question - timestamp: last 7 days
April 29, 2009, 9:32 am
rate this thread
Re: SQL / PHP question - timestamp: last 7 days
Actually it works if you use the correct syntax :)
SELECT date(now() - INTERVAL 7 DAY);
This is what happens when you use the wrong syntax:
mysql> SELECT date(now() - INTERVAL 7 DAYS);
ERROR 1064 (42000): You have an error in your SQL syntax; check the
corresponds to your MySQL server version for the right syntax to use
near 'DAYS)' at line 1
Can you spot the difference?