Q:

Subtract one week from current week of the year

I am trying to get one week earlier then current week of the year but my sql query is returning  null. here is my query
select date_sub(yearweek('2014-01-01'),INTERVAL 1 week)

what is wrong with this query

A:

If you want to get YEARWEEK of week prior to date, you can do this:
Note: YEARWEEK results in 6-digit number, first 4 digits are week year, trailing 2 digits are week number.
SELECT YEARWEEK('2014-01-01' - INTERVAL 1 WEEK)

If you need to get a date that is one week before a given date, then:
SELECT '2014-01-01' - INTERVAL 1 WEEK

