当前位置:网站首页>Sql查询时间段内容
Sql查询时间段内容
2022-06-26 05:34:00 【杰拉德·皮克·谢】
思路
- 前端传来某个时间段
startTime(String )-endTime(String )格式为天不包含时分秒 - 在书写sql 是在对应字段加上时间格式
DATE_FORMAT(crh.create_time,'%Y-%m-%d')年月日(可自由定义) - 查询结果:例如 2022-6-8 到2022-6-10的时间段
- 结果包含 6-8 0点到 6-10号 59分59秒
sql
select * from u_user where 1=1
<if test="user.endTime != null and user.endTime != '' and user.startTime != null and user.startTime != ''">
and DATE_FORMAT(crh.create_time,'%Y-%m-%d') >=#{
user.startTime}
and
DATE_FORMAT(crh.create_time,'%Y-%m-%d') <=#{
user.endTime}
</if>
边栏推荐
- Wechat team sharing: technical decryption behind wechat's 100 million daily real-time audio and video chats
- Gd32f3x0 official PWM drive has a small positive bandwidth (inaccurate timing)
- LeetCode_二叉搜索树_简单_108.将有序数组转换为二叉搜索树
- 操作符的优先级、结合性、是否控制求值顺序【详解】
- ZigBee learning in simple terms lesson 3 external interruption
- Internship May 29, 2019
- Win socket programming (Mengxin initial battle)
- Describe an experiment of Kali ARP in LAN
- Apktool tool usage document
- Mysql 源码阅读(二)登录连接调试
猜你喜欢

Replacing domestic image sources in openwrt for soft routing (take Alibaba cloud as an example)

Could not get unknown property ‘*‘ for SigningConfig container of type org.gradle.api.internal

pytorch(网络模型)
![C# 40. Byte[] to hexadecimal string](/img/3e/1b8b4e522b28eea4faca26b276a27b.png)
C# 40. Byte[] to hexadecimal string

Experience of reading the road to wealth and freedom
Posting - don't get lost in the ocean of Technology
![[red team] what preparations should be made to join the red team?](/img/03/f246f18f8925167dbd5e9d63912faa.png)
[red team] what preparations should be made to join the red team?

Sofa weekly | open source person - Yu Yu, QA this week, contributor this week

LeetCode_ Binary search tree_ Simple_ 108. convert an ordered array to a binary search tree

uniCloud云开发获取小程序用户openid
随机推荐
项目中止
Introduction to lcm32f037 series of MCU chip for motor
Leetcode513. Find the value in the lower left corner of the tree
Secondary bootloader about boot28 Precautions for ASM application, 28035
Learn cache lines and pseudo sharing of JVM slowly
A love that never leaves
A new explanation of tcp/ip five layer protocol model
Summary of the 10th provincial Blue Bridge Cup
Talk 5 wireless communication
[red team] what preparations should be made to join the red team?
Redis usage and memory optimization
Two step processing of string regular matching to get JSON list
【ARM】在NUC977上搭建基于boa的嵌入式web服务器
Install the tp6.0 framework under windows, picture and text. Thinkphp6.0 installation tutorial
uniCloud云开发获取小程序用户openid
Redis installation on Linux
Uni app ceiling fixed style
国务院发文,完善身份认证、电子印章等应用,加强数字政府建设
Introduction to alluxio
cartographer_fast_correlative_scan_matcher_2d分支定界粗匹配