Forums

This topic is locked

SQL Query Question. This is a toughy?

Posted 20 Oct 2003 14:18:14
1
has voted
20 Oct 2003 14:18:14 Russell Marshall posted:
I have two tables: tbl_hotels and tbl_HotelsRooms as follows

tbl_Hotels (This table lists the gegraphic info about the hotels.)

fld_hotelID, fld_hotelname, fld_street, fld_star, fld_town, fld_city

AND

tbl_HotelsRooms (This table lists the types of rooms available for each hotel and 3 cost rates)

fld_hotelID, fld_rmtyp, fld_offerprice, fld_clientprice, fld_rackprice

INFO: The fld_hotelID field is used to associate hotels with rooms from each table.


What I am trying to do is produce a list of hotels as follows which lists the hotels details from tbl_hotels and the room type and prices for the cheapest room available at that hotel which can then be put into a repeat region to list all the hotels available in that area.

<table width="100%" height="135" border="0" cellpadding="1" cellspacing="2">
<tr valign="top">
<!--td>Availability</td-->
<td width="22%" height="10" nowrap>Hotel</td>
<td width="6%" height="10" align="right" nowrap><div align="center">Stars</div></td>
<td height="10" nowrap><div align="left"> Room type</div></td>
<td height="10" nowrap> <table width="240" border="0" align="right" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="80" height="10"><div align="center">Offer rate </div></td>
<td width="80" height="10"><div align="center">Client rate</div></td>
<td width="80" height="10"><div align="center">Rack rate</div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="4">
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr>
<td colspan="4"><hr></td>
</tr>
<tr valign="top">
<td width="22%"><strong>Hotel Name </strong><br>
Hotel Street<br>
Hotel Town<br>
Hotel City</td>
<td width="6%"><p align="center">4</p>
<p> </p></td>
<td>Room Type</td>
<td><div align="right" class="ocol"></div>
<div align="right">
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80"><div align="right" class="ocol"></div>
<div align="right" class="ocol"><strong>Price 1 GBP</strong></div></td>
<td width="80"><div align="right" class="pcol"><strong></strong><strong>Price
2 GBP</strong></div></td>
<td width="80"><div align="right"><strong>Price 3 GBP</strong></div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="4"><hr></td>
</tr>
</table>

I am having a lot of problems defining the query.

Does anyone know how to do this?

Thanks

DAvrus

Russell

Replies

Replied 24 Oct 2003 06:21:18
24 Oct 2003 06:21:18 asp1 asp1 replied:
have you tried something like...

Select *
From tbl_hotels, tbl_HotelsRooms
Where dbo.tbl_hotels.fld_hotelID = tbl_HotelsRooms.fld_hotelID

Then just order how you want it!!
Replied 29 Oct 2003 21:54:14
29 Oct 2003 21:54:14 David Behan replied:
You still need help with this? or did you get sorted?

I was thinking using an inner join of the two tables and ordering the hotel rooms table so that it will display the one you want against the hotel you want.

Or, you could have a repeat region of the hotels with a repeat region of all the rooms (ordered how you want) within the first repeat region. That make sense??

Cheeurs,

Dave

_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.dynamic.ie

Reply to this topic