求一条MYSQL的上下周查询语句,非常感谢...

解决方案 »

  1.   

    select * from table1 where dtcolumn between curdate()-interval 7 day and  curdate()+interval 7 day
      

  2.   

    select weekofyear(now()) as '本周';
    select weekofyear(now()) - 1 as '上周';
    select weekofyear(now()) + 1 as '下周';
      

  3.   

    不太理解你的问题。建议举例说明一下。   参考一下这个贴子的提问http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
       
       
      

  4.   

    用WEEKDAY试试
    WEEKDAY(date) Returns the weekday index for date (0 = Monday, 1 = Tuesday, … 6 = Sunday). mysql> SELECT WEEKDAY('1998-02-03 22:23:00');
            -> 1
    mysql> SELECT WEEKDAY('1997-11-05');
            -> 2
      

  5.   

    这周的开始第一天
    SELECT CURDATE()-INTERVAL WEEKDAY(CURDATE()) DAY