-1
我有一个条件,如不要让用户申请已经在数据库中的日期。我在数据库中有一个日期Start_date-> 01-01-2017 & end_date-> 05-01-2017。当用户自带以下日期,我必须显示错误消息限制mysql中的日期
- startDate-> 2017年5月1日EndDate-> 2017年6月1日
- StartDate-> 31-12-2016 endaDate-> 2017年1月1日
- StartDate-> 31-12-2016结束日期 - > 2017年6月1日
- StartDate-> 2017年2月1日结束日期 - > 2017年2月1日
- StartDate-> 04 -01-2017 endDate-> 06-01-2017
我试过此查询
SELECT * from leave_request_tbl l
where leave_start_date between '2017-01-01' and '2017-01-05'
and leave_end_date between '2017-01-01'
and '2017-01-05'
order by user_id;
我不能够满足我的条件,怎么办得到事先就
感谢
日期常量的正确格式为'2017-01-05'。 –
错误的'order by user_id = 2'右'AND user_id = 2 ORDER BY user_id' – RiggsFolly
mysql日期格式为YYYY-MM-DD –