周(NOW())周日开始需要周一开始

时间:2011-11-20 22:36:59

标签: mysql

现在我有本周的拉动数据,但是星期一星期一开始,我想在星期一开始这一天我该怎么做?

$result = mysql_query("SELECT * FROM form_2 WHERE week(timestamp) = week(NOW())");

2 个答案:

答案 0 :(得分:44)

根据docs,使用WEEK(timestamp,1)

答案 1 :(得分:4)

您可以尝试:"SELECT * FROM form_2 WHERE week(timestamp - INTERVAL 1 DAY) = week(NOW() - INTERVAL 1 DAY)"