DoubleHelix66
Programmer
Hi, I have a nasty search page to produce, and I have whacked my head against the wall one too many times.
So I'm looking for some expert assistance.
THE PROBLEM
A search page with multiple dropdown menus, (3 for this simplified example).
Dropdown 1 (Member State)
NSW
VIC
TAS
Dropdown 2 (Cats)
Siamese
Burmese
Manx
Dropdown 3 (Dogs)
Labrador
Greyhound
Bulldog
There are also 3 tables
Membership Table
MemberID | MemberName | MemberState
----------------------------------------
CatType Table
CatID | MemberID | CatType
----------------------------------------
DogType Table
DogID | MemberID | DogType
----------------------------------------
I need to create an SQL query that selects MemberID, MemberName and MemberState from Membership Table, and compare the MemberID to the Cat and Dog table.
Some members will have cats, some will have dogs and some will have both.
If a user selects only a state. all cat and dog owners in that state will be displayed. (The other two dropdowns will be ignored).
If a user selects a state and a cat type.... blah, blah, you can guess the rest....
I have considered unions of the memberID fields but I need the MemberName in the resulting recordset for displaying the result, and the other fields for the search.
I can join the tables OK but I get massive result sets.
I'm sure it can be done, But if it can't please let me know.
Any pointers, suggestions, snippets or big SQL chunks would be greatly appreciated.
Thanks
Simon.
So I'm looking for some expert assistance.
THE PROBLEM
A search page with multiple dropdown menus, (3 for this simplified example).
Dropdown 1 (Member State)
NSW
VIC
TAS
Dropdown 2 (Cats)
Siamese
Burmese
Manx
Dropdown 3 (Dogs)
Labrador
Greyhound
Bulldog
There are also 3 tables
Membership Table
MemberID | MemberName | MemberState
----------------------------------------
CatType Table
CatID | MemberID | CatType
----------------------------------------
DogType Table
DogID | MemberID | DogType
----------------------------------------
I need to create an SQL query that selects MemberID, MemberName and MemberState from Membership Table, and compare the MemberID to the Cat and Dog table.
Some members will have cats, some will have dogs and some will have both.
If a user selects only a state. all cat and dog owners in that state will be displayed. (The other two dropdowns will be ignored).
If a user selects a state and a cat type.... blah, blah, you can guess the rest....
I have considered unions of the memberID fields but I need the MemberName in the resulting recordset for displaying the result, and the other fields for the search.
I can join the tables OK but I get massive result sets.
I'm sure it can be done, But if it can't please let me know.
Any pointers, suggestions, snippets or big SQL chunks would be greatly appreciated.
Thanks
Simon.