我正在尝试管理酒店客房的季节性价格。
在我的价格表中:
season startdate enddate price room_id
----------- ------------- --------------------------------
offseason 2014-03-01 2014-07-30 6500 1
season 2014-08-01 2014-12-28 7500 1
peakseason 2015-01-01 2015-03-30 8500 1
startdate 和 enddate 设置为日期,room_id 是房间表中的 id。
如果用户选择 room_id 1,入住日期为 15-03-2014,退房日期为:17-03-2014。
我想计算上述入住和退房日期都包含在哪个季节?
请帮我解决这个问题。
最佳答案
你可以试试
SELECT season from price_table where str_to_date(startdate,'%d-%m-%Y')>='15-03-2014' and str_to_date(enddate,'%d-%m-%Y')<='17-03-2014' and room_id=1
关于php - 管理酒店客房的季节性价格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23486428/