If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > date range -60 to the future

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-22-09, 15:46
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
date range -60 to the future

What I need to do is to select records withe the date column starting 60 days ago and into the future as far as there are record.

This client Daniel Hinkley Web Site has speaking engagements which currently show all future engagements but we want to also show those for the last sisty days as he wants to show slide lists and notes to the events after the fact!

Sort of like

SELECT *
FROM event_eve
WHERE date_start BETWEEN (CURDATE() -60) AND (>CURDATE())

Nick
Reply With Quote
  #2 (permalink)  
Old 02-22-09, 15:54
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
Code:
SELECT * 
   FROM event_eve
   WHERE (CURDATE() -60) < date_start
-PatP
Reply With Quote
  #3 (permalink)  
Old 02-22-09, 17:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
SELECT *
FROM event_eve
WHERE date_start >= CURRENT_DATE - INTERVAL 60 DAY



pat, you ought to test and see what CURDATE() - 60 actually produces
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 02-22-09, 19:17
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
dates

You could at least make it look hard!
Reply With Quote
  #5 (permalink)  
Old 02-23-09, 01:27
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
Not so simple, I tried to get just the records from the last sixty days without success.

SELECT *
FROM event_eve
WHERE datestart_eve = CURRENT_DATE - INTERVAL 60 DAY;
Reply With Quote
  #6 (permalink)  
Old 02-23-09, 02:20
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
Ah yes haz flavr!

never mind.. between cur....
Reply With Quote
  #7 (permalink)  
Old 02-23-09, 02:21
oldnickj oldnickj is offline
Registered User
 
Join Date: Jan 2009
Posts: 103
Ah yes haz flavr!

never mind.. between cur....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On