当前位置:网站首页>mysql中时间字段 比较时间大小
mysql中时间字段 比较时间大小
2022-06-13 07:07:00 【CSDN问答】
想要查询一个时间字段中大于0点小于两点之间的时间和大于两点之后的时间
select a.sqr '申请人',h.lastname,a.sqrq '申请日期',b.jbrq as '开始日期',b.jsrq as '结束日期',
b.sjkssj as '实际开始时间',b.sjjssj as '实际结束时间',b.sjsc as '加班时长',
case b.sjjssj
when b.sjjssj >='00:00:00' and b.sjjssj <'02:00:00' then 50
when b.sjjssj >'02:00:00' then 80
end '加班补贴'
from formtable_main_52 a
left join formtable_main_52_dt1 b on a.id = b.mainid
left join hrmresource h on h.id=a.sqr
left join workflow_requestbase w on a.requestid=w.requestid
where b.jsrq>b.jbrq and w.currentnodetype=3
但是查询出来的结果:
287 代绪军 2022-03-24 2022-03-15 2022-03-16 17:30 00:06 6 80
287 代绪军 2022-03-24 2022-03-18 2022-03-19 17:31 00:30 6.5 80
284 孙宏伟 2022-03-24 2022-03-18 2022-03-19 17:07 00:38 7 80
284 孙宏伟 2022-03-24 2022-03-15 2022-03-16 17:30 00:06 6 80
285 李彩玲 2022-03-24 2022-03-15 2022-03-16 17:30 00:06 6 80
285 李彩玲 2022-03-24 2022-03-18 2022-03-19 17:38 00:40 6.5 80
260 卞友鹏 2022-04-02 2022-04-01 2022-04-02 17:00 02:30 9
41 李小文 2022-04-02 2022-04-01 2022-04-02 17:20 03:00 9
315 张云芳 2022-04-02 2022-04-01 2022-04-02 17:00 03:00 9.5
303 余安银 2022-04-02 2022-04-01 2022-04-02 17:00 03:00 9.5
时间比较不可以使用> ,<这种比较方式吗,我试了在where条件后直接写b.sjjssj>'02:00' 查出来的结果是正确的呢,
但是在case when上面 then的结果就不对 ,是什么情况呢 郁闷
边栏推荐
- Will the chain 2+1 model be a new business outlet and a popular Internet e-commerce market?
- 在 localStorage 中上传和检索存储图像
- 数字时代进化论
- [Tencent Alibaba's most comprehensive collection of test questions] (four sides: three rounds of technology +1 round of HR)
- Implementation of fruit mall wholesale platform based on SSM
- Byte (nine)
- That is, after the negative impact of gcat advertising e-commerce, is there no stable advertising e-commerce platform?
- The new business outlet of beautiful Tiantian second mode will be popular in the Internet e-commerce market
- MySQL系列之分库分表学习笔记
- Postgraduate entrance examination English
猜你喜欢

How worker threads in the thread pool are recycled

2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一

Uploading and retrieving stored images in localstorage

That is, after the negative impact of gcat advertising e-commerce, is there no stable advertising e-commerce platform?

What is online blind box e-commerce? Can blind box e-commerce become a new bonus market for the Internet?

号称下一代监控系统 来看看它有多牛逼

New Taishan crowdfunding business diversion fission growth model in 2022

Br backup test

RT-Thread 模拟器 simulator LVGL控件:button 按钮样式

Micro isolation (MSG)
随机推荐
Upper computer development (detailed design of firmware download software)
Make cer/pfx public and private key certificates and export CFCA application certificates
FTP_ Manipulate remote files
C Advanced Programming - features
WWDC2022最大的亮点: MetalFX
ISIS的vsys(虚拟系统)
【腾讯阿里最全面试题集锦】(四面:3轮技术+1轮HR)
RT thread simulator lvgl control: switch switch button control
When the concept of industrial Internet just appeared, people only regarded it as a method to obtain b-end traffic
测试开发程序员,你还在迷茫吗?不能把自己定义为码农......
June 12, 2022: if there are n*n pieces in an n*n square chessboard, each grid can have exactly one piece. But now some pieces are gathered on a grid, such as 2030100300. The above two-dimensional arra
Differences between SQL and NoSQL of mongodb series
New Taishan crowdfunding business diversion fission growth model in 2022
SDN基本概述
【微弱瞬态信号检测】混沌背景下微弱瞬态信号的SVM检测方法的matlab仿真
How to make a development board from scratch? Illustrated and illustrated, step by step operation for you to see.
Ansible PlayBook的中清单变量优先级分析及清单变量如何分离总结
Tidb execution plan -- II
Implementation of fruit mall wholesale platform based on SSM
Tidb grafana reverse proxy