hello there,
i am looking for the simplest way to select each record from MySQL that occurs within a month because i have to use another value in each record to build a graph up to the current month in a year.
for example if this is May, i need to process the records for jan - may.
i could use strftime to get the current month and year. but it seems that there should be an easier way.
any tips ?
thanks
SELECT * FROM table WHERE date_field BETWEEN CONCAT(YEAR(CURDATE()), '-01-01') AND CURDATE()
Devinmke = won't that only get records up to today? 😉
Shrike wrote:Devinmke = won't that only get records up to today? 😉
yes...isn't that what nephish asked for...perhaps i misundertood the question. nephish said the following...
i took that to mean all records from the first day of this calender year up to this day (in may).
Ah maybe, I read it as to the end of the month.
yeah, guys, sorry. i need different sets of records. One from jan1 to jan30, feb1 - feb28, march 1 - march 31, ect and the last set will be current up to today ( this months records )
sorry about the confusion.