mysql判断时间相同的_MySQL 时间区间判断是否重复

如何判断时间区间是否重复

开始时间:2020-05-12 AM

结束时间:2020-05-12 PM

53711cb5349d5467058f9dbd21eaed38.png

SELECT

request.LEAVE_ID leaveId

FROM

T_VACATION_REQUEST_LEAVE request

WHERE

request.is_valid = 'Y'

AND request.state != '99'

AND request.LEAVE_ID != '9bc428ef-c210-4732-ada0-f7f5d48b8d81'

AND request.PROPOSER_ID = '110'

AND (

(

( DATE_FORMAT( request.LEAVE_START_TIME, '%Y-%m-%d' ) >= DATE_FORMAT( '2020-06-03T00:00:00.000+0800', '%Y-%m-%d' ) AND request.LEAVE_START_CHRONO >= 'AM' )

AND ( DATE_FORMAT( request.LEAVE_START_TIME, '%Y-%m-%d' ) <= DATE_FORMAT( '2020-06-03T00:00:00.000+0800', '%Y-%m-%d' ) AND request.LEAVE_START_CHRONO <= 'AM' )

)

OR (

( DATE_FORMAT( request.LEAVE_START_TIME, '%Y-%m-%d' ) <= DATE_FORMAT( '2020-06-03T00:00:00.000+0800', '%Y-%m-%d' ) AND request.LEAVE_START_CHRONO <= 'AM' )

AND ( DATE_FORMAT( request.LEAVE_END_TIME, '%Y-%m-%d' ) >= DATE_FORMAT( '2020-06-03T00:00:00.000+0800', '%Y-%m-%d' ) AND request.LEAVE_END_CHRONO >= 'PM' )

)

OR (

( DATE_FORMAT( request.LEAVE_END_TIME, '%Y-%m-%d' ) >= DATE_FORMAT( '2020-06-03T00:00:00.000+0800', '%Y-%m-%d' ) AND 'PM' >= request.LEAVE_START_CHRONO )

AND ( DATE_FORMAT( request.LEAVE_END_TIME, '%Y-%m-%d' ) <= DATE_FORMAT( '2020-06-03T00:00:00.000+0800', '%Y-%m-%d' ) AND 'PM' <= request.LEAVE_END_CHRONO )

)

)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值