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 > selecting a date range

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-08-05, 00:01
floydiology floydiology is offline
Registered User
 
Join Date: Mar 2005
Posts: 2
selecting a date range

I am sure this question has been posted here before, but a search has proven inconclusive.

I am hoping for some help.

I am building an event calander. I wish to show the up-coming week of events on my splash page. I have a table that is a date formatted row, 2005-03-07.

I would like to select everything from today up-to 7 days from today in a single querry. I have tried a few things out without the results that I am looking for, most querries i have tried do not discriminate between yesterday and tomarrow.
example:
query = "SELECT * FROM tblEvents WHERE tblEvents.`date` <= CURDATE()+7";

HELP!!!!A date range query will save my life!!!!
Reply With Quote
  #2 (permalink)  
Old 03-08-05, 08:04
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Code:
 where tblEvents.`date` 
       >= current_date
   and tblEvents.`date` 
       < date_add(current_date, interval 7 day)
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-08-05, 23:28
floydiology floydiology is offline
Registered User
 
Join Date: Mar 2005
Posts: 2
Thanks

This is slightly different than all the various versions of this query I have tested out, I knew I was getting twisted with it... I will try this out...THANKS!
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