Hi guys I just want to ask how can I make a query that conditions a Month - Year only selection? Like, Where the range is January 2013 - December 2014?
i have a "date" column in my table.
I usually do a date range like "WHERE date >= ? AND date <= ?" which is from date to date. I only want to select the Month and Year only, without the day.
Now I want to do "WHERE date >= (January 2013) AND date date <= (December 2014).
Is it possible? Thanks for the help!
解决方案SELECT * FROM TABLE_NAME
WHERE DATE_FORMAT(date, "%Y-%m") BETWEEN '2013-01' AND '2014-12';