strSQL="select * from hotelinfo a where id in (select hotelid from hotelrooms b where dayrent > 600 group by hotelid)
order by id desc"
...全文
2887打赏收藏
如何按照价格排序
有两个表,其中一个表hotelinfo代表公寓信息,如公寓介绍、周围标志物、地址等,表hotelrooms代表公寓客房信息,dayrent代表房 价,我现在想要做的是把公寓中所有价格高于600元的酒店显示出来,我想按照价格升序来排,我这样写,只能把符合条件的显示出来, 但是不能按照价格升序来排,请各位大虾帮忙啊! strSQL="select * from hotelinfo a where id in (select hotelid from hotelrooms b where dayren
strSQL="select a.* from hotelinfo a inner join (select hotelid,min(dayrent) as mindayrent from hotelrooms where dayrent>600 group by hotelid) b on a.id=b.hotelid order by b.mindayrent"
strSQL="select a.* from hotelinfo a inner join (select hotelid,min(dayrent) as mindayrent from hotelrooms where dayrent>600 group by hotelid) b on a.id=b.hotelid where b.mindayrent"
strSQL="select a.* from hotelinfo a,(select hotelid,dayrent from hotelrooms b where dayrent > 600 group by hotelid) b where a.id=b.hotelid order by b.dayrent desc"
里面少选了一列.
strSQL="select a.* from hotelinfo a,(select hotelid from hotelrooms b where dayrent > 600 group by hotelid) b where a.id=b.hotelid order by b.dayrent desc"