[solved]using DATE_FORMAT in the WHERE Clause

I did a search and all they showed was DATE_FORMAT being used in the SELECT part of the query. But I want to use DATE_FORMAT so it generalises the date column into the month.

Here is my query:

SELECT * FROM news WHERE DATE_FORMAT(news.thedate,'%Y-%d') = '2005-09';

Obviously, this is not working. The query goes through but no rows are returned. What can I do?

Never mind I got it. Parameters in mySQL are confusing. its ‘%Y-%m’

you might try %m (month) instead of %d (day)

:slight_smile: