I\'m building a weekly report using MySQL queries. First I get week number by
SELECT WEEK(CURDATE());
Then I need to displ
In fact, DATE_ADD is not necessary and complicates the logic. Here is the simplest version for "Date of the first day of the current week":
select date(curdate() - interval weekday(curdate()) day)
which would translate to: get the date() part of the (current date - an interval of N days) where N = today's number in the week, i.e. Thu is number 3 (for a week starting on Monday)
Then, getting the Monday of previous week, is:
select date(curdate() - interval weekday(curdate()) day - interval 1 week)
which is more readable IMHO.