当前位置:网站首页>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>
边栏推荐
- Consul服务注册与发现
- Sofa weekly | open source person - Yu Yu, QA this week, contributor this week
- [upsampling method opencv interpolation]
- Apktool tool usage document
- Internship May 29, 2019
- ZigBee learning in simple terms lesson 3 external interruption
- cartographer_ fast_ correlative_ scan_ matcher_ 2D branch and bound rough matching
- C# 40. Byte[] to hexadecimal string
- Life is so fragile
- 1212312321
猜你喜欢
Install the tp6.0 framework under windows, picture and text. Thinkphp6.0 installation tutorial
9 common classes
The wechat team disclosed that the wechat interface is stuck with a super bug "15..." The context of
LeetCode_ Binary search tree_ Simple_ 108. convert an ordered array to a binary search tree
cartographer_fast_correlative_scan_matcher_2d分支定界粗匹配
PHP 2D / multidimensional arrays are sorted in ascending and descending order according to the specified key values
DOM文档
【ARM】在NUC977上搭建基于boa的嵌入式web服务器
uniCloud云开发获取小程序用户openid
Redis usage and memory optimization
随机推荐
Installation and deployment of alluxio
[MySQL] MySQL million level data paging query method and its optimization
售前分析
MySQL source code reading (II) login connection debugging
redis探索之布隆过滤器
cartographer_optimization_problem_2d
【ARM】在NUC977上搭建基于boa的嵌入式web服务器
cartographer_ optimization_ problem_ 2d
Chapter 9 setting up structured logging (I)
数据存储:MySQL之InnoDB与MyISAM的区别
[arm] add desktop application for buildreoot of rk3568 development board
cartographer_local_trajectory_builder_2d
Redis discovery bloom filter
Daily production training report (17)
A new explanation of tcp/ip five layer protocol model
About XXX management system (version C)
Ad tutorial series | 4 - creating an integration library file
Navicat如何将当前连接信息复用另一台电脑
Leetcode114. 二叉树展开为链表
Could not get unknown property ‘*‘ for SigningConfig container of type org.gradle.api.internal