Is it possible to select a timestamp in the format YYYY-MM-DD HH-MM-SS using MySQL over a predefined monthly span?
Basically I would like the query to select all rows from the current date now() to a predefined month (e.g January).
So as an example, if the current date is the 25th June 2011 – the MySQL should select all rows from the current date, back to the 1st January 2011.
is a one way.
if you want a bit more leeway on how far you go back then instead of Makedate
use something like Concat(Cast (Year(Now) As VarChar(4)),’-01-01′)
if you build a string in the Form YYYY-MM-DD it will auto convert to the date.