MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 18th, 2000, 11:11 AM
thecrazed1 thecrazed1 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Toronto, Ontario, Canada
Posts: 19 thecrazed1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to thecrazed1
Can someone help me out with this at all? I am looking to query and display results from a field that contains the current days date. I am just not sure how to write the proper query to so that the query statement knows what the current date is.

Thanks all

Reply With Quote
  #2  
Old August 18th, 2000, 11:50 AM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
SELECT *
FROM my_table
WHERE date_column = SYSDATE;
[/code]
This, of course, assumes that the date_column column is stored as a MySQL DATE type.


Reply With Quote
  #3  
Old August 18th, 2000, 12:44 PM
Tong Tong is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 4 Tong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
> date_column = SYSDATE

oh, alright. How about yesterday? Is it:

date_column = SYSDATE -1

? thanks

Reply With Quote
  #4  
Old August 18th, 2000, 02:38 PM
thecrazed1 thecrazed1 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Toronto, Ontario, Canada
Posts: 19 thecrazed1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to thecrazed1
Can someone explain the differnece between CURDATE() and SYSDATE?

Thanks for the responses so far

Reply With Quote
  #5  
Old August 20th, 2000, 03:23 PM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
SYSDATE returns a date accurate to the current second (the same as NOW). CURDATE returns a date accurate to the current day. Generally you'll want to use CURDATE when working with just dates, and SYSDATE when you want to deal with times in days -- CURDATE is handy as CURDATE - 1 is yesterday, CURDATE + 1 is tomorrow, etc., whereas with SYSDATE, SYSDATE + 1 is one second from now. Depends on application really. My first response should really have used CURDATE rather than SYSDATE. :-)


Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Query By Today's Date


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT