PDA

View Full Version : selecting fields with the same month


Phip
07-29-2002, 08:24 AM
how can i select all the fields in a table with say the month june?

i have a column that is datetime

firepages
07-29-2002, 02:45 PM
use could use substring (though there may be a better way) - you just need to know what the date fornat is... i.e. with a TIMESTAMP(14)

SELECT * FROM $table WHERE SUBSTRING(fieldname,5,2)='06'

xajckop
07-30-2002, 05:07 PM
you can easily find the desird month:
SELECT * FROM $table WHERE date_filed LIKE '%-06-%'