Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Other Forums
 Other Topics
 How to query an Advanced Search Narrows Results
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

11 Posts

Posted - 08/18/2014 :  18:30:27  Show Profile  Reply with Quote
I have a SQL Database table named LISTINGS and it has 8 columns that users can have added a 'Y' through checkboxes in a form previously. The 8 columns are named CAT1, CAT2, CAT3, CAT4, CAT5, CAT6, CAT7 and CAT8 and all connect to the main LISTING_ID for each entered listing.

I want to have an advanced search form on the site that has the 8 fields (CAT1, CAT2, CAT3, CAT4, CAT5, CAT6, CAT7 and CAT8) as options to check one or multiple and then displays the listings with those categories if those listings have Y in the field columns.

So if someone checks 5 out of the 8 categories like CAT1, CAT3, CAT4, CAT6 and CAT8 then submits the form it will check to see if any of the listings have 'Y' in each of those columns and if so display the queried results that do.

If a listing has more then no problem as long as the fields have 'Y' that are queried so a listing that had all 5 of the above fields with 'Y' in it plus say CAT7 with a 'Y' would still show in the results.

How can this be done? Would I have to make the form use say 8 letters as values (A, B, C, D, E, F, G and H) for each option and then a separate page for each possible query option like

//do something ...

//do something ...

//do something ...

And would that not be virtually impossible with thousands of combinations going from only one field value checked for the advanced search up to all 8 checked?

Any help on this is greatly appreciated.

James Smith

Flowing Fount of Yak Knowledge

2780 Posts

Posted - 08/19/2014 :  07:55:10  Show Profile  Reply with Quote
See this article:
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000