当前位置:网站首页>MySQL time function query
MySQL time function query
2022-04-23 04:42:00 【Mount MONI】
# Query the data generated yesterday
SELECT * FROM org_user WHERE TO_DAYS( NOW( ) ) - TO_DAYS(insert_time) <= 1;
# Query near 7 Data generated in days
SELECT * FROM org_user where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(insert_time);
# Query near 30 Data generated in days
SELECT * FROM org_user where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(insert_time);
# Query the data generated this month
SELECT * FROM org_user WHERE DATE_FORMAT(insert_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' );
# Query the data generated last month
SELECT * FROM org_user WHERE PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format(insert_time, '%Y%m' ) ) = 1;
版权声明
本文为[Mount MONI]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220558292452.html
边栏推荐
- Bridge between ischemic stroke and intestinal flora: short chain fatty acids
- Interaction of diet gut microbiota on cardiovascular disease
- Go reflection - go language Bible learning notes
- IEEE Transactions on systems, man, and Cybernetics: Notes for systems (TSMC)
- zynq平臺交叉編譯器的安裝
- Practice and exploration of knowledge map visualization technology in meituan
- mysql ,binlog 日志查询
- How to regulate intestinal flora? Introduction to common natural substances, probiotics and prebiotics
- Detailed explanation of life cycle component of jetpack
- QML advanced (V) - realize all kinds of cool special effects through particle simulation system
猜你喜欢
229. 求众数 II
Programmers complain: I really can't live with a salary of 12000. Netizen: how can I say 3000
520.检测大写字母
Summary of Android development posts I interviewed in those years (attached test questions + answer analysis)
QML进阶(五)-通过粒子模拟系统实现各种炫酷的特效
基于英飞凌MCU GTM模块的无刷电机驱动方案开源啦
[paper reading] [3D target detection] point transformer
针对NFT的网络钓鱼
Record the ThreadPoolExecutor main thread waiting for sub threads
Luogu p1858 [multi person knapsack] (knapsack seeking the top k optimal solution)
随机推荐
Detailed explanation of life cycle component of jetpack
在AWS控制台创建VPC(无图版)
Summary of MySQL de duplication methods
Installation of zynq platform cross compiler
Recommended scheme of national manufactured electronic components for intelligent electronic scales
RC低通滤波器的逆系统
What is the thirty-six plan
SQL statement for adding columns in MySQL table
Bridge between ischemic stroke and intestinal flora: short chain fatty acids
leetcode001--返回和为target的数组元素的下标
Leetcode004 -- Roman numeral to integer
leetcode003--判断一个整数是否为回文数
Shanghai Hangxin technology sharing 𞓜 overview of safety characteristics of acm32 MCU
Unity摄像头跟随鼠标旋转
程序员抱怨:1万2的工资我真的活不下去了,网友:我3千咋说
The last day of 2021 is the year of harvest.
Coinbase:关于跨链桥的基础知识、事实和统计数据
补:注解(Annotation)
Go反射法则
AWS eks add cluster user or Iam role