|
-
Mar 15th, 2002, 08:30 AM
#1
Thread Starter
Addicted Member
Mysql Date + 60
I need to find all the orders that took place 60 days ago. I had
SELECT ID, name, orderdate FROM events WHERE orderdate = current_date - 60;
but its not giving me anything. Then I tried this...
SELECT ID, name, orderdate FROM events WHERE orderdate > current_date - 60;
but that is giving me all the fields in my database (it goes back to June 2001). Maybe I am misunderstanding how this current_date - x function works.
-
Mar 15th, 2002, 03:20 PM
#2
you will have to use mktime so get the correct day and the correct month for that day. what is your date forma t you are using?
-
Mar 15th, 2002, 08:23 PM
#3
PowerPoster
You can do something like this for the where clause
Code:
SELECT.......WHERE TO_DAYS(NOW()) - TO_DAYS(OrderDate) = 60
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|