Page 1 of 1

filter middle field

Posted: Wed Feb 10, 2010 10:15 pm
by alhie
I have a problem... i want to filter my table on date field for month... n my code like this :

"SELECT * FROM table WHERE substr(datefield,5,2)='02' ";

correct please ... :mrgreen:

Re: filter middle field

Posted: Wed Feb 10, 2010 11:06 pm
by pbs
What is data type of your date field

Re: filter middle field

Posted: Wed Feb 10, 2010 11:19 pm
by John Cartwright
Assuming your using the mysql DATE columns.. you could do

Code: Select all

"SELECT * FROM table WHERE MONTH(datefield) = 2";