学生公寓管理系统空房查询怎么实现?(sql数据库的语句是什么)
1个回答
展开全部
先设计几张表(不一定和LZ的一样,但你可以借鉴):
房型表type(typeid,typenum)
线上订房表A dingA(aid,typeid,aindate,aoutdate,anum)
线上订房表B dingB(bid,typeid,bindate,boutdate,bnum)
房间数num,入住时间indate,离店时间outdate
select a.typeid from type a,dingA b,dingB c where (b.aindate=indate and b.aoutdate=outdate and b.anum=num and b.typeid=a.typeid) or (c.bindate=indate and c.boutdate=outdate and c.bnum=num and c.typeid=a.typeid)
房型表type(typeid,typenum)
线上订房表A dingA(aid,typeid,aindate,aoutdate,anum)
线上订房表B dingB(bid,typeid,bindate,boutdate,bnum)
房间数num,入住时间indate,离店时间outdate
select a.typeid from type a,dingA b,dingB c where (b.aindate=indate and b.aoutdate=outdate and b.anum=num and b.typeid=a.typeid) or (c.bindate=indate and c.boutdate=outdate and c.bnum=num and c.typeid=a.typeid)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询