Make your checkboxes the same name and values the amenity_id. Then when you
submit the form you'll have a list of values that you can use in your SQL
statement. In the statement you'll want to use
Select blah
>From blah
where amenity_id IN (#perservesinglequotes(your_list)#)
or something to that effect. Just join your tables on the id fields.
Steven D Dworman
-------------------------------------------------------------------------
Web Consultant
Systems Administrator
ComSpec International - http://www.comspec-intnl.com
phone: 248.647.8841
cell: 734.972.9676
-------------------------------------------------------------------------
EMPOWER-XL ***Software for Higher Education***
http://www.empower-xl.com
-----Original Message-----
From: Jim McAtee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 25, 2001 2:56 PM
To: CF-Talk
Subject: SQL Query Quandary
I've got three tables describing lodging properties and their amenities, as
shown below. If a lodging property has more than one amenity (for example,
hot tub, min-ibar, fireplace, etc) then there are multiple records for that
property in the property_amenities table. Pretty basic stuff.
properties
-----------------------------
propertyid autonumber
propertyname text
amenities
-----------------------------
amenityid autonumber
amenitydescription text
property_amenities
-----------------------------
property_amenityid autonumber
propertyid number
amenityid number
I need to form a search for all properties that meet the criteria of having
all of the amenities that a user asks for. Not an OR, but, logically an
AND - all properties that have ALL of the amenities ask for. The user
interface is a form with check boxes, so that when the form is submitted I
have a comma delimited list of amenityid's to work with. Given the above
table structure, I have no idea how to form this query.
Thanks for any assistance,
Jim
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists