急求难题订房查询房间SQL!!!

在线订房系统,如何实现查询当前是否有所要查询的房间,
表结构如下:
--房间表room:roomId,groupId,roomName
--房间分组表group:groupId,groupName
--订单明细表orderItem:orderItemId,roomId,StartDate,EndDate

如何实现在页面输入起始时间:[img]http://dl.iteye.com/upload/attachment/434645/4111744f-605e-3c1f-a57b-a8deabd2d558.gif[/img]如startDate:2010-3-1,endDate:2010-3-5
查询出空房信息,显示在页面上,如:标准客房:已满;商务房:可预订

[img]http://dl.iteye.com/upload/attachment/434648/cdd8ca95-b203-3c14-be0c-7c0bc014fc9c.gif[/img]

2个回答

[code="sql"]select groupName from group where groupid in (select groupId from room where roomid not in (select roomid from orderItem where (startTime > '2010-3-1' and startTime < '2010-3-5' ) || (endTime > '2010-3-1' and endTime < '2010-3-5' )));[/code]

select ....from room , group where room.groupId=group.groupId and roomId in (select roomId from orderItem where StartDate>输入的离店日期 or EndDate <输入的入住日期
)
两个问题:房型、预定对应表中的具体什么属性?日期的比较?
这两个问题自己搞定呗

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问