月の初日:
SELECT DATE_FORMAT('2007-07-12', '%Y-%m-01');
出力:2007-07-01
週の最初の日:
SELECT DATE_SUB('2007-07-12', INTERVAL DAYOFWEEK('2007-07-12')-1 DAY);
出力:2007-07-08
MySQLリファレンス: http: //dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add