当前位置:网站首页>SQL 根据时间范围查询数据
SQL 根据时间范围查询数据
2022-07-30 11:30:00 【※※冰馨※※】
今天的所有数据:select * from 表名 where DateDiff(day,datetime字段,getdate())=0
昨天的所有数据:select * from 表名 where DateDiff(day,datetime字段,getdate())=1
7天内的所有数据:select * from 表名 where DateDiff(day,datetime字段,getdate())<=7
30天内的所有数据:select * from 表名 where DateDiff(day,datetime字段,getdate())<=30
本月的所有数据:select * from 表名 where DateDiff(mm,datetime字段,getdate())=0
本年的所有数据:select * from 表名 where DateDiff(yy,datetime字段,getdate())=0
注:DateDiff 前可以添加过滤条件
边栏推荐
- Verilog grammar basics HDL Bits training 08
- 周鸿祎:微软抄袭了360安全模式 所以成为美国最大的安全公司
- 云原生应用的概念和云原生应用的 15 个特征
- ORA-00600 [13013], [5001], [268] 问题分析及恢复
- Taobao/Tmall taobao comments q&a list interface API
- Flexible distribution parameters of mechanical system modeling and control of research and development
- Based on the analysis of the acoustic channel cable tunnel positioning technology
- ADC0808/9 signal acquisition developed by single chip microcomputer
- Apifox 生成接口文档 教程与操作步骤
- UE5 GAS Study Notes Postscript 0
猜你喜欢

EA中的业务对象和业务实体你分得清吗?

LeetCode_236_二叉树的最近公共祖先

【JZ64 求1+2+3+...+n】

Redis master-slave replication

Introduction to IoT Technologies: Chapter 6

HJY-F931A/YJ三相电压继电器

单片机工程师笔试题目归纳汇总

Explain the problem of change exchange in simple terms - the shell of the backpack problem

LeetCode_236_Last Common Ancestor of a Binary Tree

I built another wheel: GrpcGateway
随机推荐
高能产出!腾讯内部的MyCat中间件手册,理论实操齐下
面试官:Redis中的布隆过滤器与布谷鸟过滤器,你了解多少?
Detailed explanation of @RequestBody and @ResponseBody
[ASP.NET Core] Dependency Injection for Option Classes
不用if分支对同一个变量做判断的方法
LeetCode_235_Last Common Ancestor of Binary Search Tree
限时招募!淘宝无货源副业,800/天,不限经验,男女皆可,仅限前200名!
Difference between C# enumeration type and xaml
The battle-hardened programmer was also deceived by a fake programmer from a certain fish. The trust between programmers should be the highest, and he alone destroyed this sense of trust
High energy output!Tencent's internal MyCat middleware manual, both theoretical and practical
2022-07-29 顾宇佳 学习笔记 异常处理
Static LED display developed by single chip microcomputer
feign远程调用时如何在请求头加入数据
ORA-00600 [13013], [5001], [268] 问题分析及恢复
基于时延估计的扰动卡尔曼滤波器外力估计
The package of idea is not hollow
概率论得学习和整理6:概率的分布
Matlab基础(2)——向量与多项式
LeetCode_236_Last Common Ancestor of a Binary Tree
win下怎么搭建php环境的方法教程