Problem with query Syntax .. WHERE IN ()
Posted on 2013-12-11
Hi .. I have a query which will filter results from values passed from a form.
The form has two lists, so it may pass more than one value.
The first list is all the countries, and it will actually pass the value of the name of the country, example: Mexico
if more than one is selected something like: Hong Kong SAR, PRC, Hungary, Iceland, India, Indonesia
The second list passes on numbers (int): 02332, 123, 4324
And so on.
I want to filter my recordset based on the values passed on from the selections made on the list.
My query goes something like:
Select * from tbl .. bla bla
WHERE b.userid IN ('MMColParam11') --- this is the one that filters out with the list of numbers
AND a.PoBCountry IN ('MMColParam12') --- this is the one that filters out with the list of countries, meaning text not numbers
What is wrong with my query that I get no results.
One more thing .. if NO value is passed I need to select ALL, how to do this ?