View Single Post

   
  #7 (permalink)  
Old 02-28-2008, 10:32 AM
Paul Lautman
 
Posts: n/a
Default Re: doing query for an array of strings

Peter H. Coffin wrote:
> On Fri, 18 Jan 2008 18:52:10 +0100, yataaa wrote:
>> Hi!
>>
>> What I would like to do is this:
>> SELECT * FROM 'tableName' WHERE ColumnName is in ARRAY
>>
>> and ARRAY has the form of a set or array, like {"foo", "bar", "raz",
>> "ma", "taz"}. I can't do it like "...WHERE ColumnName='foo' OR
>> ColumnName='BAR' OR ..." because I don't know those strings and how
>> many of them are in the set before.

>
> ... WHERE ColumnName IN ('val1', 'val2', 'val3' ... );
>
> is the right way to construct that. There is a way to do it without
> knowing the match values beforehand, but Paul yells when people talk
> about it. You might be able to put your match terms into a temporary
> table and join against it.


I'm intrigued, how can one produce such a query without knowing what you
want to match against?


Reply With Quote