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

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

          Posted on 2007-10-26 20:26 itspy 閱讀(272) 評論(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

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 郴州市| 仪征市| 湘潭市| 铁岭市| 宁远县| 崇州市| 苏尼特左旗| 天峻县| 赞皇县| 寻甸| 兴安县| 邻水| 望奎县| 吉木萨尔县| 德格县| 芦溪县| 芮城县| 阆中市| 彰武县| 工布江达县| 恩施市| 南涧| 宿州市| 光山县| 嘉义市| 扎鲁特旗| 德昌县| 临潭县| 肃宁县| 林甸县| 湘潭县| 扶沟县| 凭祥市| 毕节市| 平利县| 大英县| 巴东县| 资溪县| 阿拉善右旗| 廊坊市| 安西县|