posts - 82, comments - 269, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          MySQL查詢不含周末的五天前的日期

          Posted on 2007-10-26 20:26 itspy 閱讀(275) 評論(0)  編輯  收藏
          來源:http://database.ctocio.com.cn/askexperts/216/7618716.shtml?ticket=ST-1398-lQWKhI5ZqQLqVscF67h8

          select distinct
                 cust.fname
               , cust.lname
               , cust.phone
            from orders as o
          inner
            join customers as cust
              on cust.id = orders.cust_id
           where o.date_ordered =
                 date_sub( current_date
                         , interval
                 7 - 2 * floor(dayofweek(current_date)/7)
                   + floor((dayofweek(current_date)-2)/7)
                               day )
             and o.date_shipped is null

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 威海市| 旬邑县| 云林县| 沽源县| 锦州市| 平乡县| 成都市| 轮台县| 怀来县| 昆山市| 个旧市| 疏附县| 桐庐县| 当阳市| 云林县| 云南省| 得荣县| 邛崃市| 盱眙县| 固安县| 绿春县| 扎兰屯市| 临海市| 陕西省| 霍城县| 沾益县| 大石桥市| 浙江省| 五指山市| 辽阳县| 彭泽县| 安康市| 金平| 甘南县| 韶关市| 留坝县| 太白县| 富平县| 比如县| 夹江县| 荔浦县|