SELECT ISNULL(num,0)as num ,rTime FROM fpw WHERE rTime BETWEEN CONVERT(varchar(100), #{startDay}, 20) and CONVERT(varchar(100), #{endDay}, 20) and rFirm = #{firm} and rBumen =#{bumen} AND r.._sqlse">
当前位置:   article > 正文

sql server 范围时间查询_sqlserver 时间范围查询关键字

sqlserver 时间范围查询关键字
  <select id="getFpw" resultType="java.util.Map">
      SELECT  ISNULL(num,0)as num  ,rTime FROM fpw WHERE rTime BETWEEN  CONVERT(varchar(100), #{startDay}, 20) and CONVERT(varchar(100),   #{endDay}, 20) and rFirm = #{firm} and rBumen =#{bumen} AND rZu = #{zu}
    </select>

    <select id="getFpwMonth" resultType="integer">
       SELECT  ISNULL(cast(SUM(num) as varchar),0)  FROM fpw WHERE datediff(month,[rTime],#{Date})=0 and rFirm = #{firm} and rBumen =#{bumen} AND rZu = #{zu}
    </select>

    <select id="getFpwYear" resultType="integer">
       SELECT  ISNULL(cast(SUM(num) as varchar),0)  FROM fpw WHERE datediff(year,[rTime],#{Date})=0 and rFirm = #{firm} and rBumen =#{bumen} AND rZu = #{zu}
    </select>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

数据库
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/536153
推荐阅读
相关标签
  

闽ICP备14008679号