Select partial DATE?

2001-04-20 Thread Jason Lam

Hello!

Let's say I have a DATE field and in the dataset, I got some dates such as

2000-01-01
2001-02-01
2001-02-05
2001-02-06

How would I be able to just select all the 2001-02 entries? Obviously, the month  and 
the year are the same, but the date is not, is there a mysql function to do this? 

In a nutshell, how do I select some DATE type of data just by year and month match?

Thanks

Jason Lam



Re: Select partial DATE?

2001-04-20 Thread Paul DuBois

At 9:55 PM -0400 4/20/01, Jason Lam wrote:
Hello!

Let's say I have a DATE field and in the dataset, I got some dates such as

2000-01-01
2001-02-01
2001-02-05
2001-02-06

How would I be able to just select all the 2001-02 entries? 
Obviously, the month  and the year are the same, but the date is 
not, is there a mysql function to do this?

In a nutshell, how do I select some DATE type of data just by year 
and month match?

Thanks

Jason Lam

WHERE YEAR(date) = 2001 AND MONTH(date) = 2

-- 
Paul DuBois, [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php