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.

 All Forums
 Other Forums
 Other Topics
 How to query an Advanced Search Narrows Results

Author  Topic 

Starting Member

11 Posts

Posted - 2014-08-18 : 18:30:27
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

Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-19 : 07:55:10
See this article:
Go to Top of Page

- Advertisement -