zoukankan      html  css  js  c++  java
  • 判断时间段内有几个休息期

    declare   @b   datetime,@e   datetime  
      set   @b   =   '2003-12-20'  
      set   @e   =   '2004-01-21'  
       
      select   datediff(week,@b,@e)  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   1   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   1   then   0   else   1   end   as   周日数  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   2   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   2   then   0   else   1   end   as   周一数  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   3   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   3   then   0   else   1   end   as   周二数  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   4   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   4   then   0   else   1   end   as   周三数  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   5   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   5   then   0   else   1   end   as   周四数  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   6   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   6   then   0   else   1   end   as   周五数  
      ,datediff(week,@b,@e)   +   case   when   datepart(weekday,@b)   >   7   then   0   else   1   end   -   case   when   datepart(weekday,@e)   >=   7   then   0   else   1   end   as   周六数  
  • 相关阅读:
    Leetcode 238. Product of Array Except Self
    Leetcode 103. Binary Tree Zigzag Level Order Traversal
    Leetcode 290. Word Pattern
    Leetcode 205. Isomorphic Strings
    Leetcode 107. Binary Tree Level Order Traversal II
    Leetcode 102. Binary Tree Level Order Traversal
    三目运算符
    简单判断案例— 分支结构的应用
    用switch判断月份的练习
    java基本打印练习《我行我素购物系统》
  • 原文地址:https://www.cnblogs.com/jcomet/p/1590863.html
Copyright © 2011-2022 走看看