当前位置:网站首页>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
边栏推荐
- 从MySQL数据库迁移到AWS DynamoDB
- Differences among electric drill, electric hammer and electric pick
- Shanghai Hangxin technology sharing 𞓜 overview of safety characteristics of acm32 MCU
- 520.检测大写字母
- Installation and deployment of Flink and wordcount test
- RC低通滤波器的逆系统
- Recursive call -- Enumeration of permutations
- Practice and exploration of knowledge map visualization technology in meituan
- The unity camera rotates with the mouse
- Leetcode - > 1 sum of two numbers
猜你喜欢
AWS EKS添加集群用户或IAM角色
win10, mysql-8.0.26-winx64.zip 安装
递归调用--排列的穷举
補:注解(Annotation)
Recommended scheme of national manufactured electronic components for intelligent electronic scales
Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
The perfect combination of collaborative process and multi process
Shanghai Hangxin technology sharing 𞓜 overview of safety characteristics of acm32 MCU
Recommended scheme for national production of electronic components of wireless keyboard
程序员抱怨:1万2的工资我真的活不下去了,网友:我3千咋说
随机推荐
Leetcode002 -- inverts the numeric portion of a signed integer
Unity攝像頭跟隨鼠標旋轉
Supplement: Annotation
Record your own dataset with d435i, run orbslam2 and build a dense point cloud
程序员抱怨:1万2的工资我真的活不下去了,网友:我3千咋说
Installation du compilateur croisé de la plateforme zynq
Jetpack 之 LifeCycle 组件使用详解
Code007 -- determine whether the string in parentheses matches
Key points of AWS eks deployment and differences between console and eksctl creation
Huawei machine test -- high precision integer addition
【Pytorch基础】torch.split()用法
Iron and intestinal flora
Youqilin 22.04 lts version officially released | ukui 3.1 opens a new experience
[pytoch foundation] torch Split() usage
The 14th issue of HMS core discovery reviews the long article | enjoy the silky clip and release the creativity of the video
电钻、电锤、电镐的区别
Use recyclerview to realize left-right side-by-side classification selection
用D435i录制自己的数据集运行ORBslam2并构建稠密点云
Coinbase: basic knowledge, facts and statistics about cross chain bridge
Programmers complain: I really can't live with a salary of 12000. Netizen: how can I say 3000