To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Database

Database Conversation regarding PHP and SQL

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-09-2005, 11:06 AM   #1
tiburblium
Member
 
Join Date: Apr 2002
Posts: 81
How to select date range of current month from mysql?

Greetings,

I am trying to make a select statement that will only get records from the current month. The dates are all stored in mysql in the standard format (yyyy-mm-dd), is there anyway to compare this field with a current month function?

Thanks!
tiburblium is offline   Reply With Quote
Old 11-09-2005, 04:25 PM   #2
devinemke
chocoholic (with alcohol)
 
devinemke's Avatar
 
Join Date: Aug 2002
Location: NYC
Posts: 5,153
assuming your date field is called "date"
Code:
SELECT * FROM table WHERE YEAR(date) = YEAR(CURDATE()) AND MONTH(date) = MONTH(CURDATE())
devinemke is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 11:28 AM.






Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.