php - 管理酒店客房的季节性价格

标签 php mysql

我正在尝试管理酒店客房的季节性价格。

在我的价格表中:

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/

相关文章:

c# - 从 Unity 发送变量值到 php

mysql - 返回大量结果的组合 SQL 查询

mysql - 我如何更新多行mysql?

mysql - 对 MySQL 表中的字段进行排序

php - 如何在 Google Maps API 上检查地址是否在区域内

php - Facebook 应用程序 : Secure Canvas URL

php - $_GET URL 来自 ?url=http ://google. com

php - UTF-8贯穿始终

mysql - SQL创建新列(mySQL)

android - 用于检索实体键和值总和的 Room SQL 查询