Help with search query

S

Scott Schluer

Two questions related to SQL searches (ideally everything will be in a
stored procedure):

I have an ASP.NET checkboxlist on a search page (this is a search of
properties for sale). The checkboxlist is responsible for displaying the
available amenities in a home (air conditioning, patio, garage, etc.). I
have a table tblAmenities with columns amenity_id and amenity_name. Another
table tblProperties with columns property_id, property_address, etc. Then a
lookup table that uses the property_id and amenity_id to associate amenities
with various properties.

My question is, when the user selects various checkboxes from this list
(whose values correspond to the amenity_id of the particular amenity they
chose), how do I structure the SQL statement to do the search?

Along with this question is how do I rate the results of my search by a
percentage match (among all of my search fields, including the amenities).
For example, with two identical houses, with the exception that one has 20
of their selected amenities, and the other only has 1, the one with 20
should be displayed first, along with an indicator: Percentage Match: x%.

Thanks,

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top