![](/img/trans.png)
[英]Select statement that counts matching dates (not time) from a timestamp in sql
[英]How to fetch dates from SQL by matching my travel dates?
如何获取关于hotel_id
, occu_type
, season_start
和season_end
旅行日期?
例如,如果我的旅行日期介于两次会议之间,则我的日期为30/08 / 2015、31 / 08 / 2015、01 / 09 / 2015、02 / 09/2015和03/09/2015。
我在PDO中对此使用以下查询...
$sql = $this->dbObj->query(
select DISTINCT season_start, season_end from nwts_hotel_room_rate
where hotel_id = '".$hotelid."' and occu_type = '".$arrayRmtypeopt."' and
('".$arrardepDate."' >= season_start and '".$arrardepDate."' < season_end)
);
数据库:-
http://www93.zippyshare.com/v/H33KasNa/file.html http://www39.zippyshare.com/v/KO2qYYyu/file.html
请分享任何解决方案...
据我了解,您正在选择两个日期范围,对吗?
dateStart1 dateEnd1
和
dateStart2 dateEnd2
查询将是这样的:
...和(season_start <= dateStart1和dateEnd1 <= season_end)和(season_start <= dateStart2和season_end <= dateEnd2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.