zoukankan      html  css  js  c++  java
  • 查询某日期区间的数据

    1.查询今日的所有数据

    select * from 表名 where datediff(day,字段名,getdate())=0

    2.查询昨日的所有数据

    select * from 表名 where datediff(day,字段名,getdate()-1)=0

    3.查询当天日期在一周年的数据

    selcet * from 表名 where datediff(week,字段名,getdate()-1)=0

    4.查询前30天的数据

    select * from 表名 where datediff(d,字段名,getdate())<=30

    5.查询上一个月的数据

    select * from 表名 where datediff(m,字段名,getdate())<=1

    6.查询当天的数据

    select * from 表名 where datediff(dd,字段名,getdate())=0

    7.查询24小时内的数据

    select * from 表名 where datediff(hh,字段名,getdate())

    8.查询本周的数据

    select * from 表名 where datediff(week,字段名,getdate())=0

    9.查询本月的数据

    select * from 表名 where datediff(month,字段名,getdate())=0

    10.查询本季的数据

    select * from 表名 where datediff(qq,字段名,getdate())=0
    ————————————————
    版权声明:本文为CSDN博主「smartsmile2012」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/smartsmile2012/article/details/93976959

  • 相关阅读:
    采样错误
    MathJax
    jupyter
    pip
    str操作
    Content-Type
    json转csv
    【tornado】静态文件
    dict 字典
    基于插件技术的GIS应用框架(C# + ArcEngine9.3)(一)
  • 原文地址:https://www.cnblogs.com/Anthony518/p/11456755.html
Copyright © 2011-2022 走看看