Hello!
I'm stuck on a SQL statement that I was wondering if someone
could possibly assist me with.
I working on a search page for a particular company site of
antique dealers. There is a "Search By Categories" section on the
main search page where users can select multiple checkboxes to
return any antique dealers in those categories.
When the search button is clicked, a comma delimited string
of category IDs is passed to the search results page. (ex.
"2,14,15,20,22,25,37,40")
Each antique dealer has a database field that contains a
comma delimited list of any category IDs that they are associated
with since they can be associated with more than one category if
they'd like to be...and just about all of them are currently
associated with more than one category
SO...we have a string being passed from the search page that
could look something like this: 2,14,18,20,22,25,37,40,64
...and in the database each dealer has a DealerCats field for
all the categories they're associated with that might look like
this: 6,7,18,30,64,66
My question is: how can I write the select statement to
basically say "select all dealers from the Dealers table where any
of the passed category IDs (clicked on from the search page) exist
in the DealerCats field for each dealer?"
I already tried something to the effect of:
SELECT * FROM DEALERS
WHERE DealerCats IN (#FORM.dealerCat#)
...but this did not work. I don't get an error, I just get a
blank content area (the rest of the template is not broken in any
way...just blank area where either results should appear or a "no
results" message should appear.
Also, I DID create a page that displays both the form value
of the selected checkboxes as well as any given DealerCats field in
the database to make sure that both are comma separated values
formatted exactly the same.
Unfortunately, I am unable to provide outside access to the
testing server that I'm working off of for this particular company,
so I do apologize.
However, if anyone understands what it is I am trying to
accomplish and can based on my explanation, I hope that will help.
Feel free to ask for any additional clarification.
Thank you very much!!!
- Tony
Chicago, Freelance Web Developer