Hi All,

Talk about a need for 5.0's query a query. I need some suggestions on how to
rework this:

I am working on a room reservation system. The system is pretty basic. A
user signs in and clicks on a monthly matrix (Rooms x DaysInMonth). My
problem (see below) is that right now I end up querying for each day at the
room level to find out if its occupied which results in 15 x (28 to 31)
queries which is terribly inefficient (processing = 600 ms).

Suggestions on improvements:

<cfloop from=1 to=15 index=thisRoom>
        <cfloop from=1 to=DaysInMonth(thisDate) index=thisDay>
                <cfquery ....>
                        SELECT status
                        FROM    reservs
                        WHERE   room_id = #thisRoom# AND
                                date_reserv = #x/thisDay/xxxx#
                </cfquery>
        </cfloop>
</cfloop>

Suggestions on improvements?

Thx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to