Hi, I have a DB with the date for each record in format yyyy-mm-dd i want to run a select statement which only selects the month. E.g. Something like this: SELECT * FROM `table` WHERE date(month) = '$month' Code (markup): Cheers, Adam
You didn't specified nor field type, nor database engine. If it is Mysql and field is datetime, you can use a SQL: SELECT * FROM `table` WHERE MONTH(yourdatefield) = '$month' Code (markup): where $month is a month number. Also to speed up this select, I would recommend to add an index on this datetime field.