当前位置:网站首页>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 前可以添加过滤条件
边栏推荐
- Matlab基础(5)——符号运算
- Performance testing of API Gateway APISIX on Google Cloud T2A and T2D
- 获取1688app上原数据 API
- STM32F1 reads MLX90632 non-contact infrared temperature sensor
- 流水线上的农民:我在工厂种蔬菜
- Farmers on the assembly line: I grow vegetables in a factory
- Voltage relay HDY - vac - 1 A / 1-220
- 电压继电器SRMUVS-100VAC-2H2D
- Difference between C# enumeration type and xaml
- 牛客-TOP101-BM42
猜你喜欢

Typroa 替代工具marktext

高能产出!腾讯内部的MyCat中间件手册,理论实操齐下

Current relay JL-8GB/11/AC220V

域名怎么注册备案解析?

时间序列曲线相似性

STM32F1读取MLX90632非接触式红外温度传感器

Horizontal comparison of 5 commonly used registration centers, whether it is used for interviews or technical selection, is very helpful

横向对比5种常用的注册中心,无论是用于面试还是技术选型,都非常有帮助

Introduction to IoT Technologies: Chapter 6

超图iServer rest服务之最佳路径分析
随机推荐
文本的对齐方式、行高、空间 等总结
Voltage relay HDY - vac - 1 A / 1-220
Database transactions, JDBC operations and data types
spin lock和mutex使用场景的差异
HJY-F931A/YJ three-phase voltage relay
流水线上的农民:我在工厂种蔬菜
STM32F1 reads MLX90632 non-contact infrared temperature sensor
柔性机械系统分布参数建模及其控制的研究与进展
Verilog语法基础HDL Bits训练 08
GBJ2510-ASEMI电机专用25A整流桥GBJ2510
Jingdong school recruited written test questions + summary of knowledge points
反转链表-递归反转法
汇编实现冒泡排序
面试官:Redis中的布隆过滤器与布谷鸟过滤器,你了解多少?
Taobao/Tmall taobao comments q&a list interface API
周鸿祎:微软抄袭了360安全模式 所以成为美国最大的安全公司
基于MySQL数据库,Redis缓存,MQ消息中间件,ES搜索引擎的高可用方案解析
English line break
Performance testing of API Gateway APISIX on Google Cloud T2A and T2D
UE5 GAS Study Notes Postscript 0