If you do a cfoutput group (room num), then you can limit the room to one 
display per room number.  Use the columns in the booked table to determine if 
the room should be highlighted.

Also, a booked room is usually determined by a date and time of the booking.  
If this is true with you system, you will need to add date and time to your 
queries.

william

William Seiter (mobile)

Have you ever read a book that changed your life?
go to:  http://www.winninginthemargins.com
and use passcod: GoldenGrove

-----Original Message-----
From: "Toby King" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: 1/28/2008 2:05 PM
Subject: Help witha query

Hi there

I have 2 tables in A MySQL database.  A room table and a room occupancy table 
which stores records for a selected period of time.

What I want to do is display all rooms (rooms 1-20) along with the status of 
the room.

Currently my query is as follows:

select distinct tbl_rooms.roomno, tbl_jobs.bookingstatus
from tbl_rooms left join tbl_jobs
on tbl_rooms.roomid = tbl_jobs.roomid
order by roomno

What I am getting is the following displayed:

Rooms

1 1 2 2 3 4 5 6 7 8

Basically I have the following in my tables - I have one record for each room 
in the rooms table and multiple records in the tbl_jobs table. 

Room 1 has multiple records where the booking has been completed and one record 
showing that the room is currently booked.  The same for room 2. Room 3 has 
only been booked before and there are no current bookings for room 3. 

Room 4 has never been booked before but shows up as it is a room in the Room 
table.  Room 5 has a number of completed bookings and is currently booked

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297610
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to