[英]compare two date in mysql
hotel check in & check out time is 酒店入住和退房时间是
Table data 表数据
check in check out room name
2018-09-17 11:00:00 2018-09-19 11:00:00 room 1
2018-09-18 11:00:00 2018-09-19 11:00:00 room 2
Note : Standard Check in and Check out time : 11:00 AM
注意:标准入住和退房时间:上午11:00
if i try for date from 2018-09-17 11:00:00 to 2018-09-18 11:00:00
then output for that date total booked should be 1.
room 1 is booked and room 2 should be free. 如果我尝试
from 2018-09-17 11:00:00 to 2018-09-18 11:00:00
日期from 2018-09-17 11:00:00 to 2018-09-18 11:00:00
那么output for that date total booked should be 1.
房间1预订,房间2应该是免费的。
my query 我的查询
SELECT * FROM transcationmaster WHERE checkin >= STR_TO_DATE('2018-09-17 11:00:00', '%Y-%m-%d %H:%i:%s') and checkout <= STR_TO_DATE('2018-09-18 11:00:00', '%Y-%m-%d %H:%i:%s')
how to do this in mysql? 如何在mysql中执行此操作?
Thanks in advance 提前致谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.